diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
36 files changed, 1469 insertions, 937 deletions
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/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/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..5f922e0c99 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; } @@ -348,7 +374,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 +397,7 @@ public class VnfAdapterVfModuleObjectMapper { } } } - **/ + } private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { @@ -726,4 +752,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/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..5a63d2097b 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; @@ -69,11 +63,6 @@ public class BaseClient<I,O> { public O run(I data, HttpMethod method, 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, 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/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/VnfAdapterVfModuleObjectMapperPayloadTest.java index b4c73ceb3b..9c51ee8006 100644 --- 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/VnfAdapterVfModuleObjectMapperPayloadTest.java @@ -26,7 +26,8 @@ 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.Before; import org.junit.Test; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; @@ -34,8 +35,8 @@ 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.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; @@ -44,12 +45,19 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import com.fasterxml.jackson.databind.ObjectMapper; -public class VnfAdapterVfModuleObjectMapperIntegrationTest { +public class VnfAdapterVfModuleObjectMapperPayloadTest { - 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/"; + private VnfAdapterVfModuleObjectMapper vfModuleObjectMapper = new VnfAdapterVfModuleObjectMapper(); + private ObjectMapper omapper = new ObjectMapper(); + @Before + public void setUp() { + vfModuleObjectMapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + vfModuleObjectMapper.init(); + + } @Test - @Ignore public void createVfModuleRequestMapperTest() throws Exception { // prepare and set service instance @@ -63,16 +71,82 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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", "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 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", "value1"); + userParams.put("key1", "value2"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); @@ -101,6 +175,14 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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"); @@ -112,18 +194,161 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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 = 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 = mapper.createVfModuleRequestMapper( + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + vnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json"))); + 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); - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( + 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); @@ -131,7 +356,6 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { } @Test - @Ignore public void createVfModuleRequestMapperWithCloudResourcesTest() throws Exception { // prepare and set service instance @@ -145,13 +369,7 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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"); @@ -194,18 +412,14 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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( + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json"))); - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( + CreateVfModuleRequest reqMapper1 = omapper.readValue( jsonToCompare, CreateVfModuleRequest.class); @@ -213,7 +427,6 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { } @Test - @Ignore public void createVfModuleRequestMapperDhcpDisabledTest() throws Exception { // prepare and set service instance ServiceInstance serviceInstance = new ServiceInstance(); @@ -226,14 +439,6 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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>(); @@ -277,18 +482,14 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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( + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json"))); - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( + CreateVfModuleRequest reqMapper1 = omapper.readValue( jsonToCompare, CreateVfModuleRequest.class); @@ -296,7 +497,6 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { } @Test - @Ignore public void createVfModuleRequestMapperMultipleDhcpTest() throws Exception { // prepare and set service instance ServiceInstance serviceInstance = new ServiceInstance(); @@ -309,13 +509,6 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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>(); @@ -359,18 +552,82 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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( + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json"))); - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( + 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); @@ -389,13 +646,7 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { 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"); @@ -433,18 +684,14 @@ public class VnfAdapterVfModuleObjectMapperIntegrationTest { OrchestrationContext orchestrationContext = new OrchestrationContext(); orchestrationContext.setIsRollbackEnabled(false); - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - DeleteVfModuleRequest vfModuleVNFAdapterRequest = mapper.deleteVfModuleRequestMapper( + DeleteVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.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( + DeleteVfModuleRequest reqMapper1 = omapper.readValue( jsonToCompare, DeleteVfModuleRequest.class); 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/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/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 |