diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks')
52 files changed, 2194 insertions, 1342 deletions
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index 68f7e5a3bb..3483aed8a7 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -30,6 +30,12 @@ <groupId>org.onap.sdnc.northbound</groupId> <artifactId>generic-resource-api-client</artifactId> <version>1.4.0-SNAPSHOT</version> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> 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/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index 69fc633bbd..3456fa1c56 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -92,13 +92,18 @@ public class VnfAdapterCreateTasks { ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VolumeGroup volumeGroup = null; + try { + volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + } catch(BBObjectNotFoundException bbException) { + } CloudRegion cloudRegion = gBBInput.getCloudRegion(); RequestContext requestContext = gBBInput.getRequestContext(); OrchestrationContext orchestrationContext = gBBInput.getOrchContext(); String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()); - CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString()); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); 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/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java index fd5f00ed6f..6fcad95144 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java @@ -26,6 +26,7 @@ public class Resource { private WorkflowType resourceType; private boolean generated; private boolean baseVfModule; + private String virtualLinkKey; public Resource(WorkflowType resourceType, String resourceId, boolean generated){ this.resourceId = resourceId; @@ -57,4 +58,10 @@ public class Resource { public void setBaseVfModule(boolean baseVfModule) { this.baseVfModule = baseVfModule; } + public String getVirtualLinkKey() { + return virtualLinkKey; + } + public void setVirtualLinkKey(String virtualLinkKey) { + this.virtualLinkKey = virtualLinkKey; + } } 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 0f02928d16..c6a63e1431 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 @@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; @@ -159,7 +160,7 @@ public class WorkflowAction { } for (OrchestrationFlow orchFlow : orchFlows) { ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null); flowsToExecute.add(ebb); } } else { @@ -264,6 +265,7 @@ public class WorkflowAction { execution.setVariable("flowsToExecute", flowsToExecute); } catch (Exception ex) { + msoLogger.error(ex); buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex); } } @@ -289,7 +291,7 @@ public class WorkflowAction { Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ - updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type)); + updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null); } }); } @@ -309,12 +311,13 @@ public class WorkflowAction { Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ - updateWorkflowResourceIds(flowsToExecute, type, resourceCounter.stream().filter(x -> type.equals(x.getResourceType())) - .collect(Collectors.toList()).get(i).getResourceId(), null); } + Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())) + .collect(Collectors.toList()).get(i); + updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); } }); } - protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id){ + protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){ String resourceId = id; if(resourceId==null){ resourceId = UUID.randomUUID().toString(); @@ -335,6 +338,12 @@ public class WorkflowAction { } ebb.setWorkflowResourceIds(workflowResourceIds); } + if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink() + && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) { + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setNetworkId(resourceId); + ebb.setWorkflowResourceIds(workflowResourceIds); + } } } @@ -381,18 +390,29 @@ public class WorkflowAction { InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); CollectionResourceInstanceGroupCustomization collectionInstCust = null; if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) { - collectionInstCust = instanceGroup.getCollectionInstanceGroupCustomizations().get(0); - if(collectionInstCust.getSubInterfaceNetworkQuantity() != null) { + for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) { + if(collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) { + collectionInstCust = collectionInstanceGroupTemp; + break; + } + } + if(collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null) { minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity(); } } msoLogger.debug("minNetworks: " + minNetworks); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = null; + for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) { + if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) { + collectionNetworkResourceCust = collectionNetworkTemp; + break; + } + } for (int i = 0; i < minNetworks; i++) { - if(collectionInstCust != null) { - - resourceCounter.add( - new Resource(WorkflowType.VIRTUAL_LINK,instanceGroup.getCollectionNetworkResourceCustomizations() - .get(0).getModelCustomizationUUID(),false)); + if(collectionNetworkResourceCust != null && collectionInstCust != null) { + Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,collectionNetworkResourceCust.getModelCustomizationUUID(),false); + resource.setVirtualLinkKey(Integer.toString(i)); + resourceCounter.add(resource); } } } else { @@ -633,7 +653,7 @@ public class WorkflowAction { if (vnf != null && vnf.getVfModules() != null) { for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { Optional<VolumeGroup> volumeGroupFromVfModule = bbInputSetupUtils - .getRelatedVolumeGroupByNameFromVfModule(vfModule.getVfModuleId(), instanceName); + .getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(), vfModule.getVfModuleId(), instanceName); if (volumeGroupFromVfModule.isPresent()) { return volumeGroupFromVfModule.get().getVolumeGroupId(); } @@ -642,6 +662,7 @@ public class WorkflowAction { } return generatedResourceId; } catch (Exception ex) { + msoLogger.error(ex); throw new IllegalStateException( "WorkflowAction was unable to verify if the instance name already exist in AAI."); } @@ -666,20 +687,32 @@ public class WorkflowAction { for (ExecuteBuildingBlock ebb : orchFlows) { if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) { String key = ebb.getBuildingBlock().getKey(); + boolean isVirtualLink = ebb.getBuildingBlock().getIsVirtualLink(); + String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey(); sortedOrchFlows.add(ebb); for (ExecuteBuildingBlock ebb2 : orchFlows) { - if (ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { sortedOrchFlows.add(ebb2); break; } + if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) { + sortedOrchFlows.add(ebb2); + break; + } } for (ExecuteBuildingBlock ebb2 : orchFlows) { - if (ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") + if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { sortedOrchFlows.add(ebb2); break; } + if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") + && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) { + sortedOrchFlows.add(ebb2); + break; + } } } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) { @@ -729,48 +762,49 @@ public class WorkflowAction { workflowResourceIds.setServiceInstanceId(resourceId); flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(VNF)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(NETWORK) && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true)); + Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()) + .collect(Collectors.toList()).get(i); + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource.getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey())); } } else if (orchFlow.getFlowName().contains(VFMODULE)) { List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) .collect(Collectors.toList())); for (int i = 0; i < vfModuleResourcesSorted.size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } return flowsToExecute; @@ -778,13 +812,14 @@ public class WorkflowAction { protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType, - WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink) { + WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey) { ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); BuildingBlock buildingBlock = new BuildingBlock(); buildingBlock.setBpmnFlowName(orchFlow.getFlowName()); buildingBlock.setMsoId(UUID.randomUUID().toString()); buildingBlock.setKey(key); buildingBlock.setIsVirtualLink(isVirtualLink); + buildingBlock.setVirtualLinkKey(virtualLinkKey); executeBuildingBlock.setApiVersion(apiVersion); executeBuildingBlock.setaLaCarte(aLaCarte); executeBuildingBlock.setRequestAction(requestAction); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index 373ed63fda..94dfdcc747 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -266,6 +266,10 @@ public class AAIObjectMapper { protected void configure() { map().setModelInvariantId(source.getModelInfoCollection().getModelInvariantUUID()); map().setModelVersionId(source.getModelInfoCollection().getModelVersionId()); + map().setCollectionCustomizationId(source.getModelInfoCollection().getModelCustomizationUUID()); + map().setCollectionFunction(source.getModelInfoCollection().getCollectionFunction()); + map().setCollectionRole(source.getModelInfoCollection().getCollectionRole()); + map().setCollectionType(source.getModelInfoCollection().getCollectionType()); map().setCollectionName(source.getName()); } }); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index a1501da0e2..ee8f503e42 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -240,7 +240,7 @@ public class NetworkAdapterObjectMapper { for (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet subnet : subnets) { org.onap.so.openstack.beans.Subnet openstackSubnet = modelMapper.map(subnet, org.onap.so.openstack.beans.Subnet.class); //update cidr value - if (subnet.getNetworkStartAddress() != null & subnet.getCidrMask() != null) + if (subnet.getNetworkStartAddress() != null && subnet.getCidrMask() != null) openstackSubnet.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask())); List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes(); List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java index d8dde57135..67e7afb599 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -20,14 +20,18 @@ package org.onap.so.client.adapter.vnf.mapper; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.annotation.PostConstruct; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; import org.onap.so.bpmn.core.UrnPropertiesReader; @@ -41,16 +45,19 @@ import org.onap.so.entity.MsoRequest; import org.springframework.stereotype.Component; import org.springframework.web.util.UriUtils; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class VnfAdapterObjectMapper { private ObjectMapper mapper = new ObjectMapper(); + + @PostConstruct + public void init () { + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + } public CreateVolumeGroupRequest createVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest(); @@ -101,7 +108,7 @@ public class VnfAdapterObjectMapper { final String USER_PARAM_NAME_KEY = "name"; final String USER_PARAM_VALUE_KEY = "value"; // sdncVfModuleQueryResponse will not be available in aLaCarte case - if (sdncVfModuleQueryResponse != null) { + if (sdncVfModuleQueryResponse != null) { GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters()); } @@ -164,4 +171,4 @@ public class VnfAdapterObjectMapper { return UrnPropertiesReader.getVariable(key); } -} +}
\ No newline at end of file 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 c4dcd1aed9..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 @@ -30,18 +30,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; -import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; -import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; -import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.entity.MsoRequest; -import org.onap.so.jsonpath.JsonPathUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; @@ -57,18 +46,37 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataInte import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkInformationItems; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkinformationitemNetworkIps; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataSriovParameters; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNames; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNetworks; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmnamesVnfcNames; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfNetworkData; -import org.onap.sdnc.northbound.client.model.*; - +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcNetworkData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcNetworkData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfResourceAssignments; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyVnfTopology; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.entity.MsoRequest; +import org.onap.so.jsonpath.JsonPathUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -96,19 +104,33 @@ public class VnfAdapterVfModuleObjectMapper { private static final String FLOATING_V6_IP = "_floating_v6_ip"; private static final String UNDERSCORE = "_"; + @PostConstruct + public void init () { + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + } + public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, - VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest(); createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); createVfModuleRequest.setTenantId(cloudRegion.getTenantId()); createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId()); createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName()); - createVfModuleRequest.setVnfType(genericVnf.getVnfType()); + createVfModuleRequest.setVnfId(genericVnf.getVnfId()); + createVfModuleRequest.setVnfType(genericVnf.getVnfType()); createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName()); createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID()); - + if (volumeGroup != null) { + createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + } + VfModule baseVfModule = getBaseVfModule(genericVnf); + if (baseVfModule != null) { + createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId()); + createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId()); + } createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse)); createVfModuleRequest.setSkipAAI(true); @@ -134,6 +156,7 @@ public class VnfAdapterVfModuleObjectMapper { private Map<String,String> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + GenericResourceApiVnftopologyVnfTopology vnfTopology = mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnftopologyVnfTopology.class); GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); Map<String,String> paramsMap = new HashMap<>(); @@ -151,7 +174,10 @@ public class VnfAdapterVfModuleObjectMapper { buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule); // Parameters received from the request should overwrite any parameters received from SDNC - paramsMap.putAll(requestContext.getUserParams()); + + if (requestContext.getUserParams() != null) { + paramsMap.putAll(requestContext.getUserParams()); + } return paramsMap; } @@ -161,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()); @@ -348,7 +376,7 @@ public class VnfAdapterVfModuleObjectMapper { } private void buildVfModuleSriovParameters(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String networkKey) { - /** SRIOV Parameters + // SRIOV Parameters GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters(); if (sriovParameters != null) { GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters heatVlanFilters = sriovParameters.getHeatVlanFilters(); @@ -371,7 +399,7 @@ public class VnfAdapterVfModuleObjectMapper { } } } - **/ + } private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { @@ -726,4 +754,18 @@ public class VnfAdapterVfModuleObjectMapper { return json; } + + private VfModule getBaseVfModule(GenericVnf genericVnf) { + List<VfModule> vfModules = genericVnf.getVfModules(); + VfModule baseVfModule = null; + if (vfModules != null) { + for(int i = 0; i < vfModules.size(); i++) { + if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) { + baseVfModule = vfModules.get(i); + break; + } + } + } + return baseVfModule; + } } 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/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java index e52616677d..2d9032c7c0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java @@ -28,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; @@ -43,8 +44,8 @@ public class VnfAdapterVfModuleResources { private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper; public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, - VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException { - return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException { + return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); } public DeleteVfModuleRequest deleteVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java index 1ce7a92eb5..50137cf985 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java @@ -20,11 +20,6 @@ package org.onap.so.client.sdnc; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.Collections; - import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -32,7 +27,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.client.BufferingClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; @@ -58,25 +52,19 @@ public class BaseClient<I,O> { this.targetUrl = targetUrl; } - public O get(I data, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.GET, uriVariables); + public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.GET, typeRef, uriVariables); } - public O post(I data, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.POST, uriVariables); + public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.POST, typeRef, uriVariables); } - public O run(I data, HttpMethod method, Object... uriVariables) throws RestClientException { + public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); RestTemplate restTemplate = new RestTemplate(); - ObjectMapper mapper = new ObjectMapper(); - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - converter.setObjectMapper(mapper); - mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - restTemplate.getMessageConverters().add(0, converter); restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); - ParameterizedTypeReference<O> output = new ParameterizedTypeReference<O>() {}; - ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, output, + ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables); return responseEntity.getBody(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index 1f0d654a85..9e60196426 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -21,6 +21,7 @@ package org.onap.so.client.sdnc; import java.util.LinkedHashMap; + import javax.ws.rs.core.UriBuilder; import org.onap.so.client.exception.BadResponseException; @@ -29,6 +30,7 @@ import org.onap.so.client.sdnc.beans.SDNCProperties; import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; @@ -58,7 +60,7 @@ public class SDNCClient { HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl); - LinkedHashMap<?, ?> output = STOClient.post(jsonRequest); + LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNResponse(output); } @@ -84,7 +86,7 @@ public class SDNCClient { HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); msoLogger.info("Running SDNC CLIENT..."); - LinkedHashMap<?, ?> output = STOClient.get(jsonRequest); + LinkedHashMap<?, ?> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNGetResponse(output); } 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/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java index 979b9e5e80..cee94e28bd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java @@ -31,6 +31,7 @@ import org.onap.so.client.sniro.beans.SniroConductorRequest; import org.onap.so.client.sniro.beans.SniroManagerRequest; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; @@ -76,7 +77,7 @@ public class SniroClient { baseClient.setTargetUrl(url); baseClient.setHttpHeader(header); - LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString()); + LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); validator.validateDemandsResponse(response); log.trace("Completed Sniro Client Post Demands"); } @@ -106,7 +107,7 @@ public class SniroClient { baseClient.setTargetUrl(url); baseClient.setHttpHeader(header); - LinkedHashMap<?, ?> response = baseClient.post(releaseRequest.toJsonString()); + LinkedHashMap<?, ?> response = baseClient.post(releaseRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); SniroValidator v = new SniroValidator(); v.validateReleaseResponse(response); log.trace("Completed Sniro Client Post Release"); 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/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java index f54e3faf1d..698ebb33f2 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java @@ -138,12 +138,52 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); vnfAdapterCreateTasks.createVfModule(execution); verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString()); + } + + @Test + public void test_createVfModuleWithVolumeGroup() throws Exception { + RequestContext requestContext = setRequestContext(); + + ServiceInstance serviceInstance = setServiceInstance(); + + GenericVnf genericVnf = setGenericVnf(); + + VfModule vfModule = setVfModule(); + + VolumeGroup volumeGroup = setVolumeGroup(); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVfModuleRequest modRequest = new CreateVfModuleRequest(); + modRequest.setVfModuleId(vfModule.getVfModuleId()); + modRequest.setBaseVfModuleStackId("baseVfModuleStackId"); + modRequest.setVfModuleName(vfModule.getVfModuleName()); + CreateVfModuleRequest createVfModuleRequest = modRequest; + + String sdncVfModuleQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVfModuleQueryResponse); + + String sdncVnfQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); + + doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + vnfAdapterCreateTasks.createVfModule(execution); + + verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString()); } 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/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index c910ad19fa..283f8881c7 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 @@ -600,12 +600,15 @@ public class WorkflowActionTest extends BaseTaskTest { instanceGroup.setCollectionNetworkResourceCustomizations(new ArrayList<>()); CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization(); collectionNetworkResourceCust.setModelCustomizationUUID("123"); + collectionNetworkResourceCust.setNetworkResourceCustomization(collectionResourceCustomization); instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust ); List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>(); CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCustomization.setModelCustomizationUUID("123"); collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3); collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization); collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup); + collectionInstanceGroupCustomization.setCollectionResourceCust(collectionResourceCustomization); instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations); collectionResource.setInstanceGroup(instanceGroup); collectionResourceCustomization.setCollectionResource(collectionResource);; @@ -618,14 +621,32 @@ public class WorkflowActionTest extends BaseTaskTest { assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB"); assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(2).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(3).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(4).getWorkflowResourceIds().getNetworkId().isEmpty(), true); + assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", + ebbs.get(2).getWorkflowResourceIds().getNetworkId() == ebbs.get(3).getWorkflowResourceIds().getNetworkId() + && ebbs.get(3).getWorkflowResourceIds().getNetworkId() == ebbs.get(4).getWorkflowResourceIds().getNetworkId(), true); assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(5).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(6).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(7).getWorkflowResourceIds().getNetworkId().isEmpty(), true); + assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", + ebbs.get(5).getWorkflowResourceIds().getNetworkId() == ebbs.get(6).getWorkflowResourceIds().getNetworkId() + && ebbs.get(6).getWorkflowResourceIds().getNetworkId() == ebbs.get(7).getWorkflowResourceIds().getNetworkId(), true); assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(8).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(9).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(10).getWorkflowResourceIds().getNetworkId().isEmpty(), true); + assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", + ebbs.get(8).getWorkflowResourceIds().getNetworkId() == ebbs.get(9).getWorkflowResourceIds().getNetworkId() + && ebbs.get(9).getWorkflowResourceIds().getNetworkId() == ebbs.get(10).getWorkflowResourceIds().getNetworkId(), true); assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB"); assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); } @@ -1423,7 +1444,7 @@ public class WorkflowActionTest extends BaseTaskTest { workflowResourceIds.setVnfId("id444"); when(bbSetupUtils.getAAIGenericVnf("id444")).thenReturn(vnf); - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123","111111")).thenReturn(opVolumeGroup); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123","111111")).thenReturn(opVolumeGroup); when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id444","111111")).thenReturn(Optional.empty()); id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails, workflowResourceIds); assertEquals("id123",id2); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index 88f8526f31..6edda44c0a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -350,11 +350,19 @@ public class AAIObjectMapperTest{ ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); modelInfoCollection.setCollectionFunction("networkCollectionFunction"); modelInfoCollection.setCollectionRole("networkCollectionRole"); + modelInfoCollection.setCollectionType("networkCollectionType"); + modelInfoCollection.setModelCustomizationUUID("modelCustomizationUUID"); + modelInfoCollection.setModelVersionId("modelVersionId"); + modelInfoCollection.setModelInvariantUUID("modelInvariantUUID"); networkCollection.setModelInfoCollection(modelInfoCollection); networkCollection.setName("networkCollectionName"); org.onap.aai.domain.yang.Collection expectedCollection = new org.onap.aai.domain.yang.Collection(); expectedCollection.setCollectionId("networkCollectionId"); + expectedCollection.setCollectionType("networkCollectionType"); + expectedCollection.setCollectionCustomizationId("modelCustomizationUUID"); + expectedCollection.setModelVersionId("modelVersionId"); + expectedCollection.setModelInvariantId("modelInvariantUUID"); expectedCollection.setCollectionFunction("networkCollectionFunction"); expectedCollection.setCollectionRole("networkCollectionRole"); expectedCollection.setCollectionName("networkCollectionName"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java index 13bdfc87a1..b2f01f007f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -55,7 +55,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.entity.MsoRequest; public class VnfAdapterObjectMapperTest { - private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/"; @Spy private VnfAdapterObjectMapper vnfAdapterObjectMapper = new VnfAdapterObjectMapper(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java deleted file mode 100644 index b4c73ceb3b..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java +++ /dev/null @@ -1,453 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 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.client.adapter.vnf.mapper; - -import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; - -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashMap; -import org.junit.Ignore; -import org.junit.Test; -import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; -import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; -import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; -import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; -import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class VnfAdapterVfModuleObjectMapperIntegrationTest { - - private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; - - @Test - @Ignore - public void createVfModuleRequestMapperTest() 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("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - // - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - 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"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - @Ignore - public void createVfModuleRequestMapperWithCloudResourcesTest() 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("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - // - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - 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 + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json"))); - String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - @Ignore - public void createVfModuleRequestMapperDhcpDisabledTest() 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("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - - - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - 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 + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json"))); - String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - @Ignore - public void createVfModuleRequestMapperMultipleDhcpTest() 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("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - 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 + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json"))); - String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - public void DeleteVfModuleRequestMapperTest() throws Exception { - 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("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - // - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - 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); - - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("vfModuleId"); - vfModule.setVfModuleName("vfModuleName"); - 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); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - DeleteVfModuleRequest vfModuleVNFAdapterRequest = mapper.deleteVfModuleRequestMapper( - requestContext, cloudRegion, serviceInstance, - vnf, vfModule); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json"))); - - ObjectMapper omapper = new ObjectMapper(); - DeleteVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - DeleteVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } -} 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 new file mode 100644 index 0000000000..1bb59e7b8d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java @@ -0,0 +1,770 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.vnf.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VnfAdapterVfModuleObjectMapperPayloadTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/"; + + private VnfAdapterVfModuleObjectMapper vfModuleObjectMapper = new VnfAdapterVfModuleObjectMapper(); + private ObjectMapper omapper = new ObjectMapper(); + @Before + public void setUp() { + vfModuleObjectMapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + vfModuleObjectMapper.init(); + + } + @Test + public void createVfModuleRequestMapperTest() 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + 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 + "vnfAdapterCreateVfModuleRequest.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @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 + 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + 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); + + VfModule baseVfModule = new VfModule(); + baseVfModule.setVfModuleId("baseVfModuleId"); + baseVfModule.setHeatStackId("baseVfModuleStackId"); + ModelInfoVfModule baseModelInfoVfModule = new ModelInfoVfModule(); + baseModelInfoVfModule.setIsBaseBoolean(true); + baseVfModule.setModelInfoVfModule(baseModelInfoVfModule); + vnf.getVfModules().add(baseVfModule); + + 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 + "vnfAdapterCreateVfModuleAddonRequest.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleWithVolumeGroupRequestMapperTest() 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + 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); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setHeatStackId("volumeGroupStackId"); + + 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, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithVolumeGroupRequest.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleWithSingleAvailabilityZoneRequestMapperTest() 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + 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 + "genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.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 + "vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperWithCloudResourcesTest() 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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 + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.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 + "vnfAdapterCreateVfModuleRequestWithCloudResources.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperDhcpDisabledTest() 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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 + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.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 + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperMultipleDhcpTest() 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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 + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.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 + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperWithNullUserParamsTest() 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("requestId"); + 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 + "vnfAdapterCreateVfModuleRequestNoUserParams.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void DeleteVfModuleRequestMapperTest() throws Exception { + 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("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + 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); + + DeleteVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.deleteVfModuleRequestMapper( + requestContext, cloudRegion, serviceInstance, + vnf, vfModule); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json"))); + + DeleteVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + DeleteVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } +} 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/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java index dfed3c8929..f7c12104cc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java @@ -33,13 +33,14 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; @@ -59,6 +60,7 @@ public class VnfAdapterVfModuleResourcesTest extends TestDataSetup{ private ModelInfoServiceInstance modelInfoServiceInstance; private GenericVnf genericVnf; private VfModule vfModule; + private VolumeGroup volumeGroup; private ModelInfoVfModule modelInfoVfModule; private CloudRegion cloudRegion; private OrchestrationContext orchestrationContext; @@ -95,13 +97,30 @@ public class VnfAdapterVfModuleResourcesTest extends TestDataSetup{ @Test public void test_createVfModule() throws Exception { doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertNotNull(createVfModuleRequest); + assertNotNull(actualCreateVfModuleRequest); + assertEquals(createVfModuleRequest, actualCreateVfModuleRequest); + } + + @Test + public void test_createVfModuleWithVolumeGroup() throws Exception { + volumeGroup = buildVolumeGroup(); + doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); assertNotNull(createVfModuleRequest); assertNotNull(actualCreateVfModuleRequest); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java new file mode 100644 index 0000000000..a564d8a21d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java @@ -0,0 +1,50 @@ +package org.onap.so.client.sdnc; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.util.Map; + +import javax.ws.rs.core.UriBuilder; + +import org.junit.Rule; +import org.junit.Test; +import org.springframework.core.ParameterizedTypeReference; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +import wiremock.org.apache.http.entity.ContentType; +public class BaseClientTest { + + + @Rule + public WireMockRule wm = new WireMockRule(options().dynamicPort()); + + @Test + public void verifyString() { + BaseClient<String, String> client = new BaseClient<>(); + String response = "{\"hello\" : \"world\"}"; + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString()); + wm.stubFor(get(urlEqualTo("/test")) + .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); + + String result = client.get("", new ParameterizedTypeReference<String>() {}); + assertThat(result, equalTo(response)); + } + + @Test + public void verifyMap() { + BaseClient<String, Map<String, Object>> client = new BaseClient<>(); + String response = "{\"hello\" : \"world\"}"; + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString()); + wm.stubFor(get(urlEqualTo("/test")) + .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); + + Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {}); + assertThat("world", equalTo(result.get("hello"))); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json new file mode 100644 index 0000000000..a24f8bf125 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json @@ -0,0 +1,178 @@ +{ + "vf-module-assignments": { + "vms": { + "vm": [ + { + "vm-type": "vmType0", + "vm-names": { + "vm-name": [ + "vmName0", + "vmName1" + ], + "vnfc-names": [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": { + "vnfc-network-data": [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": { + "vnfc-port": [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": { + "network-information-item": [ + { + "ip-version": "ipv4", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + }, + { + "ip-version": "ipv6", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + } + ] + }, + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + "vm-networks": { + "vm-network": [ + { + "network-role": "vmNetworkRole0", + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + }, + "interface-route-prefixes": { + "interface-route-prefix": [ + "interfaceRoutePrefix0", + "interfaceRoutePrefix1" + ] + }, + "sriov-parameters": { + "heat-vlan-filters": { + "heat-vlan-filter": [ + "heatVlanFilter0", + "heatVlanFilter1" + ] + } + }, + "network-information-items": { + "network-information-item": [ + { + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + }, + "ip-version": "ipv4" + }, + { + "network-ips": { + "network-ip": [ + "ip2", + "ip3" + ] + }, + "ip-version": "ipv6" + } + ] + } + } + ] + } + } + ] + } + }, + "vf-module-parameters": { + "param": [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json new file mode 100644 index 0000000000..eaedb92281 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json @@ -0,0 +1,179 @@ +{ + "vf-module-assignments": { + "vms": { + "vm": [ + { + "vm-type": "vmType0", + "vm-names": { + "vm-name": [ + "vmName0", + "vmName1" + ], + "vnfc-names": [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": { + "vnfc-network-data": [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": { + "vnfc-port": [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": { + "network-information-item": [ + { + "ip-version": "ipv4", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + }, + { + "ip-version": "ipv6", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + } + ] + }, + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + "vm-networks": { + "vm-network": [ + { + "network-role": "vmNetworkRole0", + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + }, + "interface-route-prefixes": { + "interface-route-prefix": [ + "interfaceRoutePrefix0", + "interfaceRoutePrefix1" + ] + }, + "sriov-parameters": { + "heat-vlan-filters": { + "heat-vlan-filter": [ + "heatVlanFilter0", + "heatVlanFilter1" + ] + } + }, + "network-information-items": { + "network-information-item": [ + { + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + }, + "ip-version": "ipv4" + }, + { + "network-ips": { + "network-ip": [ + "ip2", + "ip3" + ] + }, + "ip-version": "ipv6" + } + ] + } + } + ] + } + } + ] + } + }, + "vf-module-parameters": { + "param": [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + } + ] + }, + "sdnc-generated-cloud-resources": "true" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json new file mode 100644 index 0000000000..39c6708631 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json @@ -0,0 +1,48 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled": "Y" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json new file mode 100644 index 0000000000..21ba0876f5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json @@ -0,0 +1,48 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled": "N" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json new file mode 100644 index 0000000000..5062a06117 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json @@ -0,0 +1,68 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId1", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId2", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId3", + "dhcp-enabled": "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId4", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId5", + "dhcp-enabled": "Y" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json new file mode 100644 index 0000000000..fedee49609 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json @@ -0,0 +1,47 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "", + "sdnc-generated-cloud-resources": "true" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json new file mode 100644 index 0000000000..a6964a323f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json @@ -0,0 +1,44 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": "zone0" + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled": "Y" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json new file mode 100644 index 0000000000..c4e7237511 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json @@ -0,0 +1,69 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "baseVfModuleId": "baseVfModuleId", + "baseVfModuleStackId": "baseVfModuleStackId", + "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": "environmentContext", + "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": "workloadContext", + "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 diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json index a30ee59d5c..0db327eae4 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", @@ -37,7 +38,7 @@ "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", "workload_context": "workloadContext", - "key1": "value1", + "key1": "value2", "availability_zone_0": "zone0", "availability_zone_1": "zone1", "availability_zone_2": "zone2", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json index 49a68b909a..90326e33eb 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json index a862051582..2f943a67bc 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json new file mode 100644 index 0000000000..4c50ad1187 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.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": "environmentContext", + "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": "workloadContext", + "key1": "value1", + "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 diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json index 9c77f14f4b..d80c739916 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json new file mode 100644 index 0000000000..293c6c21ed --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json @@ -0,0 +1,65 @@ +{ + "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": "environmentContext", + "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": "workloadContext", + "key1": "value2", + "availability_zone_0": "zone0", + "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 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 diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json new file mode 100644 index 0000000000..dff1ccf7b0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json @@ -0,0 +1,69 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "volumeGroupId": "volumeGroupId", + "volumeGroupStackId": "volumeGroupStackId", + "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": "environmentContext", + "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": "workloadContext", + "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 diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json index 21e5bde3ec..21e5bde3ec 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json deleted file mode 100644 index 1497286a1b..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "vf-module-assignments": - { - "vms": - { - "vm": - [ - { - "vm-type": "vmType0", - "vm-names": - { - "vm-name": - [ - "vmName0", - "vmName1" - ], - - "vnfc-names": - [ - { - "vnfc-name": "vnfcName0", - "vnfc-networks": - { - "vnfc-network-data": - [ - { - "vnfc-network-role": "vnfcNetworkRole0", - "vnfc-type": "fw", - "vnfc-ports": - { - "vnfc-port": - [ - { - "vnfc-port-id": "01", - "common-sub-interface-role": "ctrl", - "vnic-sub-interfaces": - { - "sub-interface-network-data": - [ - { - "network-id": "networkId0", - "network-name": 1, - "vlan-tag-id": 1, - "network-information-items": - { - "network-information-item": - [ - { - "ip-version": "ipv4", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - }, - - { - "ip-version": "ipv6", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - } - ] - }, - - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - } - } - ] - } - } - ] - } - } - ] - } - } - ] - }, - - "vm-networks": - { - "vm-network": - [ - { - "network-role": "vmNetworkRole0", - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - }, - - "interface-route-prefixes": - { - "interface-route-prefix": - [ - "interfaceRoutePrefix0", - "interfaceRoutePrefix1" - ] - }, - - "sriov-parameters": - { - "heat-vlan-filters": - { - "heat-vlan-filter": - [ - "heatVlanFilter0", - "heatVlanFilter1" - ] - } - }, - - "network-information-items": - { - "network-information-item": - [ - { - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - }, - - "ip-version": "ipv4" - }, - - { - "network-ips": - { - "network-ip": - [ - "ip2", - "ip3" - ] - }, - - "ip-version": "ipv6" - } - ] - } - } - ] - } - } - ] - } - }, - - "vf-module-parameters": - { - "param": - [ - { - "name": "paramOne", - "value": "paramOneValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramTwo", - "value": "paramTwoValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramThree", - "value": "paramThreeValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - } - ] - } -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json deleted file mode 100644 index 2a8acb927e..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "vf-module-assignments": - { - "vms": - { - "vm": - [ - { - "vm-type": "vmType0", - "vm-names": - { - "vm-name": - [ - "vmName0", - "vmName1" - ], - - "vnfc-names": - [ - { - "vnfc-name": "vnfcName0", - "vnfc-networks": - { - "vnfc-network-data": - [ - { - "vnfc-network-role": "vnfcNetworkRole0", - "vnfc-type": "fw", - "vnfc-ports": - { - "vnfc-port": - [ - { - "vnfc-port-id": "01", - "common-sub-interface-role": "ctrl", - "vnic-sub-interfaces": - { - "sub-interface-network-data": - [ - { - "network-id": "networkId0", - "network-name": 1, - "vlan-tag-id": 1, - "network-information-items": - { - "network-information-item": - [ - { - "ip-version": "ipv4", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - }, - - { - "ip-version": "ipv6", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - } - ] - }, - - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - } - } - ] - } - } - ] - } - } - ] - } - } - ] - }, - - "vm-networks": - { - "vm-network": - [ - { - "network-role": "vmNetworkRole0", - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - }, - - "interface-route-prefixes": - { - "interface-route-prefix": - [ - "interfaceRoutePrefix0", - "interfaceRoutePrefix1" - ] - }, - - "sriov-parameters": - { - "heat-vlan-filters": - { - "heat-vlan-filter": - [ - "heatVlanFilter0", - "heatVlanFilter1" - ] - } - }, - - "network-information-items": - { - "network-information-item": - [ - { - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - }, - - "ip-version": "ipv4" - }, - - { - "network-ips": - { - "network-ip": - [ - "ip2", - "ip3" - ] - }, - - "ip-version": "ipv6" - } - ] - } - } - ] - } - } - ] - } - }, - - "vf-module-parameters": - { - "param": - [ - { - "name": "paramOne", - "value": "paramOneValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramTwo", - "value": "paramTwoValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramThree", - "value": "paramThreeValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - } - ] - }, - - "sdnc-generated-cloud-resources": "true" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json deleted file mode 100644 index 2c7728397f..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId1", - "dhcp-enabled" : "Y" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json deleted file mode 100644 index a302777810..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0", - "dhcp-enabled" : "N" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId1", - "dhcp-enabled" : "N" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json deleted file mode 100644 index 67c095a217..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv4", - "subnet-id": "subnetId1", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv4", - "subnet-id": "subnetId2", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId3", - "dhcp-enabled" : "N" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId4", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId5", - "dhcp-enabled" : "Y" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json deleted file mode 100644 index 0047764713..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0" - }, - - { - "ip-version": "ipv6", - "subnet-id": "subnetId1" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "", - - "sdnc-generated-cloud-resources": "true" -}
\ No newline at end of file |