diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-08-09 09:32:29 -0400 |
---|---|---|
committer | Marcus Williams <marcus.williams@intel.com> | 2018-08-09 22:34:52 +0000 |
commit | 709352852e50aa92edc9cf80a7d1c0387c532521 (patch) | |
tree | ecdb8b85504808f7c35f76ab6332cbab9f320b3b | |
parent | f690106dbb6f2da96fdaa35541bc5ba152f9d299 (diff) |
GR-API flow, VF Module, SDNC GR API Fixes
Fixes the new GR-API flow
Various fixes in the create VF Module area
Fixes issues parsing the SDNC GR API response
Fixes new resource type in ASDC controller
Fixes AppC mismatch in JSON marshaling
Issue-ID: SO-821
Change-Id: I4ace0d348483ab1303fcfee26c5801674be51466
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
63 files changed, 1682 insertions, 1009 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index 565ddf42b5..8353f708a9 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -65,7 +65,6 @@ public class ToscaResourceStructure { String envHeatTemplateUUID; String heatFilesUUID; String workloadPerformance; - boolean isVnfAlreadyInstalled = false; String serviceVersion; private boolean isDeployedSuccessfully=false; @@ -314,14 +313,6 @@ public class ToscaResourceStructure { this.toscaCsar = toscaCsar; } - public boolean isVnfAlreadyInstalled() { - return isVnfAlreadyInstalled; - } - - public void setVnfAlreadyInstalled(boolean isVnfAlreadyInstalled) { - this.isVnfAlreadyInstalled = isVnfAlreadyInstalled; - } - public String getVolHeatTemplateUUID() { return volHeatTemplateUUID; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index ea952f6daf..87df2648d1 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -440,33 +440,13 @@ public class ToscaResourceInstaller { VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure,vfMetadata, vnfResource); vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); }else - throw (new Exception("Cannot find matching VFModule Customization")); + throw new Exception("Cannot find matching VFModule Customization for VF Module Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID()); } service.getVnfCustomizations().add(vnfResource); } } - protected void processFlexware(ToscaResourceStructure toscaResourceStruct, Service service, NodeTemplate nodeTemplate, - String serviceType) { - if (serviceType != null && serviceType.equalsIgnoreCase("Flexware")) { - - createVnfResource(nodeTemplate, toscaResourceStruct, service); - String modelName = toscaResourceStruct.getVnfResourceCustomization().getVnfResources().getModelName(); - - String modelVersion = BigDecimalVersion.castAndCheckNotificationVersionToString( - toscaResourceStruct.getCatalogVnfResourceCustomization().getVnfResources().getModelVersion()); - // check for duplicate record already in the database - VnfResource vnfResource = vnfRepo.findByModelNameAndModelVersion(modelName, modelVersion); - - if (vnfResource != null) { - toscaResourceStruct.setVnfAlreadyInstalled(true); - } - - vnfCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogVnfResourceCustomization()); - } - } - public void processWatchdog(String distributionId, String servideUUID) { WatchdogServiceModVerIdLookup modVerIdLookup = new WatchdogServiceModVerIdLookup(distributionId,servideUUID); watchdogModVerIdLookupRepository.saveAndFlush(modVerIdLookup); @@ -1263,12 +1243,20 @@ public class ToscaResourceInstaller { // Set all Child Templates related to HEAT_VOLUME if(!volumeHeatChildTemplates.isEmpty()){ - vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates); + if(vfModule.getVolumeHeatTemplate() != null){ + vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates); + }else{ + logger.debug("VolumeHeatTemplate not set in setHeatInformationForVfModule()"); + } } // Set all Child Templates related to HEAT if(!heatChildTemplates.isEmpty()){ - vfModule.getVolumeHeatTemplate().setChildTemplates(heatChildTemplates); + if(vfModule.getModuleHeatTemplate() != null){ + vfModule.getModuleHeatTemplate().setChildTemplates(heatChildTemplates); + }else{ + logger.debug("ModuleHeatTemplate not set in setHeatInformationForVfModule()"); + } } } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java index ef5b889d09..13af95a8fc 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java @@ -212,6 +212,9 @@ public class ASDCNotificationLogging { buffer.append("Model Name:"); buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(System.lineSeparator()); buffer.append("Description:"); buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); buffer.append(System.lineSeparator()); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java index de0d2e08a1..1e8b72d145 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java @@ -83,7 +83,6 @@ public class ToscaResourceStructureTest { toscaResourceStructure.setHeatFilesUUID("heatFilesUUID"); toscaResourceStructure.setToscaArtifact(artifactInfo); toscaResourceStructure.setToscaCsar(new ToscaCsar()); - toscaResourceStructure.setVnfAlreadyInstalled(true); toscaResourceStructure.setVolHeatTemplateUUID("volHeatTemplateUUID"); toscaResourceStructure.setEnvHeatTemplateUUID("envHeatTemplateUUID"); toscaResourceStructure.setServiceVersion("serviceVersion"); @@ -111,7 +110,6 @@ public class ToscaResourceStructureTest { assertEquals("heatFilesUUID", toscaResourceStructure.getHeatFilesUUID()); assertEquals(artifactInfo, toscaResourceStructure.getToscaArtifact()); assertThat(toscaResourceStructure.getToscaCsar(), sameBeanAs(new ToscaCsar())); - assertEquals(true, toscaResourceStructure.isVnfAlreadyInstalled()); assertEquals("volHeatTemplateUUID", toscaResourceStructure.getVolHeatTemplateUUID()); assertEquals("envHeatTemplateUUID", toscaResourceStructure.getEnvHeatTemplateUUID()); assertEquals("serviceVersion", toscaResourceStructure.getServiceVersion()); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index d96e480945..af0987f6d0 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -343,7 +343,6 @@ public class ToscaResourceInstallerTest extends BaseTest { doReturn(nodeTemplateList).when(sdcCsarHelper).getAllottedResources(); doReturn(metadata).when(nodeTemplate).getMetaData(); doReturn("model_instance_name").when(nodeTemplate).getName(); - doReturn(false).when(toscaResourceStruct).isVnfAlreadyInstalled(); doReturn(vnfResourceCustomization).when(toscaResourceStruct).getCatalogVnfResourceCustomization(); doReturn(allottedResource).when(toscaResourceStruct).getAllottedResource(); doReturn(allottedResourceCustomization).when(toscaResourceStruct).getCatalogAllottedResourceCustomization(); @@ -474,6 +473,131 @@ public class ToscaResourceInstallerTest extends BaseTest { return actualWatchdogComponentDistributionStatus; } + private void populatevfResourceStructure() throws Exception { + vfResourceStructure = spy(new VfResourceStructure(notificationData, resourceInstance)); - + HashMap<String, VfModuleArtifact> vfModuleArtifacts = mock(HashMap.class); + CapabilityAssignments capabilityAssignments = mock(CapabilityAssignments.class); + CapabilityAssignment capabilityAssignment = mock(CapabilityAssignment.class); + + Iterator artifactIterator = mock(Iterator.class); + Iterator nodeTemplateIterator = mock(Iterator.class); + IDistributionClientDownloadResult clientResult = mock(IDistributionClientDownloadResult.class); + doReturn(IOUtils.toByteArray( + new FileInputStream( + new File( + getClass().getClassLoader().getResource("resource-examples/simpleTest.yaml").getFile()) + ))).when(clientResult).getArtifactPayload(); + VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult); + Collection<VfModuleArtifact> vfModuleArtifactsValues = mock(Collection.class); + + NodeTemplate nodeTemplate = mock(NodeTemplate.class); + List<NodeTemplate> nodeTemplateList = new ArrayList<>(); + nodeTemplateList.add(nodeTemplate); + + doReturn(sdcCsarHelper).when(toscaResourceStruct).getSdcCsarHelper(); + doReturn("metadataPropertyValue").when(sdcCsarHelper).getMetadataPropertyValue(any(Metadata.class), any(String.class)); + doReturn("ntPropertyLeafValue").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(any(NodeTemplate.class), any(String.class)); + doReturn("true").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK); + doReturn("1").when(sdcCsarHelper).getCapabilityPropertyLeafValue(any(CapabilityAssignment.class), any(String.class)); + doReturn(vfGroups).when(sdcCsarHelper).getVfModulesByVf(any(String.class)); + doReturn(capabilityAssignments).when(sdcCsarHelper).getCapabilitiesOf(any(NodeTemplate.class)); + doReturn(capabilityAssignment).when(capabilityAssignments).getCapabilityByName(any(String.class)); + doReturn(vfModuleArtifacts).when(vfResourceStructure).getArtifactsMapByUUID(); + when(vfModuleArtifacts.values()).thenReturn(vfModuleArtifactsValues); + when(vfModuleArtifactsValues.iterator()).thenReturn(artifactIterator); + when(artifactIterator.hasNext()).thenReturn(true, false); + when(artifactIterator.next()).thenReturn(vfModuleArtifact); + when(artifactInfo.getArtifactType()).thenReturn(ASDCConfiguration.OTHER); + when(nodeTemplateIterator.hasNext()).thenReturn(true, false); + doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVfList(); + doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVlList(); + doReturn(nodeTemplateList).when(sdcCsarHelper).getAllottedResources(); + doReturn(metadata).when(nodeTemplate).getMetaData(); + doReturn("model_instance_name").when(nodeTemplate).getName(); + } + + private void populateToscaResourceStruct() { + + VnfResource vnfResource = new VnfResource(); + vnfResource.setModelName("modelName"); + vnfResource.setModelVersion("1.1"); + vnfResource.setModelUUID("modelUUID"); + vnfResource.setOrchestrationMode("orchestrationMode"); + + VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); + vnfResourceCustomization.setVnfResources(vnfResource); + vnfResourceCustomization.setModelCustomizationUUID("vnfResCustModelCustomizationUUID"); + vnfResourceCustomization.setModelInstanceName("modelInstanceName"); + + allottedResource = new AllottedResource(); + allottedResource.setModelUUID("serviceMetadataValue"); + allottedResource.setModelInvariantUUID("modelInvariantUUID"); + allottedResource.setModelName("modelName"); + allottedResource.setModelVersion("1.1"); + + allottedResourceCustomization = new AllottedResourceCustomization(); + allottedResourceCustomization.setAllottedResource(allottedResource); + allottedResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID"); + allottedResourceCustomization.setModelInstanceName("modelInstanceName"); + + catalogService = new Service(); + catalogService.setServiceType("Bonding"); + catalogService.setModelUUID("5df8b6de-2083-11e7-93ae-92361f002672"); + catalogService.setModelInvariantUUID("modelInvariantUUID"); + catalogService.setModelName("modelName"); + catalogService.setModelVersion("modelVersion"); + catalogService.getVnfCustomizations().add(vnfResourceCustomization); + + catalogService.setServiceRole("COLLABORATE"); + + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setArtifactUuid("ff874603-4222-11e7-9252-005056850d2e"); + heatTemplate.setArtifactChecksum("MANUAL RECORD"); + heatTemplate.setTemplateBody("templateBody"); + heatTemplate.setTemplateName("module_mns_zrdm3frwl01exn_01_rgvm_1.yml"); + heatTemplate.setVersion("1"); + + NetworkResource networkResource = new NetworkResource(); + networkResource.setAicVersionMin("aicVersionMin"); + networkResource.setModelUUID("modelUUID"); + networkResource.setOrchestrationMode("orchestrationMode"); + networkResource.setModelVersion("modelVersion"); + networkResource.setNeutronNetworkType("neutronNetworkType"); + networkResource.setAicVersionMax("aicVersionMax"); + networkResource.setModelName("CONTRAIL30_GNDIRECT"); + networkResource.setModelInvariantUUID("modelInvariantUUID"); + networkResource.setHeatTemplate(heatTemplate); + + NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization(); + networkResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID"); + networkResourceCustomization.setModelInstanceName("modelInstanceName"); + networkResourceCustomization.setNetworkResource(networkResource); + + doReturn(networkResource).when(toscaResourceStruct).getCatalogNetworkResource(); + doReturn(networkResourceCustomization).when(toscaResourceStruct).getCatalogNetworkResourceCustomization(); + doNothing().when(toscaResourceStruct).setSuccessfulDeployment(); + doReturn("serviceVersion").when(toscaResourceStruct).getServiceVersion(); + doReturn(catalogService).when(toscaResourceStruct).getCatalogService(); + doReturn(artifactInfo).when(toscaResourceStruct).getToscaArtifact(); + doReturn("artifactChecksum").when(artifactInfo).getArtifactChecksum(); + doReturn("artifactUUID").when(artifactInfo).getArtifactUUID(); + doReturn("artifactName").when(artifactInfo).getArtifactName(); + doReturn("1.0").when(artifactInfo).getArtifactVersion(); + doReturn("artifactDescription").when(artifactInfo).getArtifactDescription(); + doReturn("artifactURL").when(artifactInfo).getArtifactURL(); + doReturn(metadata).when(toscaResourceStruct).getServiceMetadata(); + doReturn("serviceMetadataValue").when(metadata).getValue(any(String.class)); + doReturn("CONTRAIL30_GNDIRECT").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + doReturn(vnfResourceCustomization).when(toscaResourceStruct).getCatalogVnfResourceCustomization(); + doReturn(allottedResource).when(toscaResourceStruct).getAllottedResource(); + doReturn(allottedResourceCustomization).when(toscaResourceStruct).getCatalogAllottedResourceCustomization(); + } + + private void populateNotificationData() { + notificationData.setDistributionID("testStatusSuccessTosca"); + notificationData.setServiceVersion("123456"); + notificationData.setServiceUUID("5df8b6de-2083-11e7-93ae-92361f002671"); + notificationData.setWorkloadContext("workloadContext"); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index d3ddc60d3e..ca1acc5963 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -48,8 +48,8 @@ public class PayloadClient { UpgradeAction payloadResult = new UpgradeAction(); ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); String payloadString = payload.isPresent() ? payload.get() : ""; - String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing-software-version"); - String newSoftware = JsonUtils.getJsonValue(payloadString, "new-software-version"); + String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing_software_version"); + String newSoftware = JsonUtils.getJsonValue(payloadString, "new_software_version"); configParams.setExistingSoftwareVersion(existingSoftware); configParams.setNewSoftwareVersion(newSoftware); configParams.setVnfName(vnfName); @@ -69,7 +69,7 @@ public class PayloadClient { QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); String payloadString = payload.isPresent() ? payload.get() : ""; - String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); + String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations_timeout"); configParams.setOperationsTimeout(operationsTimeout); configParams.setVnfName(vnfName); payloadResult.setConfigurationParameters(configParams); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java index ff51b06dbe..6bd397a63a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java @@ -27,15 +27,15 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "vnf_name", -"existing-software-version", -"new-software-version" +"existing_software_version", +"new_software_version" }) public class ConfigurationParametersUpgrade { @JsonProperty("vnf_name") private String vnfName; -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") private String existingSoftwareVersion; -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") private String newSoftwareVersion; @JsonProperty("vnf_name") @@ -48,22 +48,22 @@ public void setVnfName(String vnfName) { this.vnfName = vnfName; } -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") public String getExistingSoftwareVersion() { return existingSoftwareVersion; } -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") public void setExistingSoftwareVersion(String existingSoftwareVersion) { this.existingSoftwareVersion = existingSoftwareVersion; } -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") public String getNewSoftwareVersion() { return newSoftwareVersion; } -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") public void setNewSoftwareVersion(String newSoftwareVersion) { this.newSoftwareVersion = newSoftwareVersion; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java index 5746dcd586..38f974168e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -38,6 +38,8 @@ public class BuildingBlock implements Serializable{ private String key; @JsonProperty("is-virtual-link") private boolean isVirtualLink; + @JsonProperty("virtual-link-key") + private String virtualLinkKey; public String getBpmnFlowName() { return bpmnFlowName; @@ -63,4 +65,10 @@ public class BuildingBlock implements Serializable{ public void setIsVirtualLink(boolean isVirtualLink) { this.isVirtualLink = isVirtualLink; } + public String getVirtualLinkKey() { + return virtualLinkKey; + } + public void setVirtualLinkKey(String virtualLinkKey) { + this.virtualLinkKey = virtualLinkKey; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java index 6ceac935f1..349010781d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java @@ -27,7 +27,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoCollection implements Serializable { private static final long serialVersionUID = 8380534468706675508L; - + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUUID; @JsonProperty("model-version-id") private String modelVersionId; @JsonProperty("model-invariant-uuid") @@ -43,6 +45,12 @@ public class ModelInfoCollection implements Serializable { @JsonProperty("quantity") private int quantity; + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } public String getModelVersionId() { return modelVersionId; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index aa68114011..ab6ae35ace 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -65,6 +65,7 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; @@ -1452,7 +1453,9 @@ public class BBInputSetup implements JavaDelegate { aaiCollection = aaiCollectionOp.get(); Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); - + NetworkCollectionResourceCustomization collectionResourceCust = + bbInputSetupUtils.getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, collectionResourceCust.getCollectionResource())); Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); Relationships relationships = null; if (relationshipsOp.isPresent()) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 04f9cdcb86..abd7ed5a8e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -201,6 +201,7 @@ public class BBInputSetupMapperLayer { modelInfoCollection.setDescription(collectionResource.getDescription()); modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID()); modelInfoCollection.setModelVersionId(collectionResource.getModelUUID()); + modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID()); return modelInfoCollection; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 14c162935a..3a88377a51 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -49,6 +49,7 @@ import org.onap.so.client.db.request.RequestsDbClient; import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -127,6 +128,11 @@ public class BBInputSetupUtils { return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key); } + public NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID( + String collectionCustomizationId) { + return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId); + } + public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) { return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); } @@ -389,8 +395,8 @@ public class BBInputSetupUtils { } } - public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vfModuleId, String volumeGroupName) throws Exception { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vfModuleId); + public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId, String volumeGroupName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); VolumeGroup volumeGroup = null; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java index 8d681d721c..80b978e4fd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java @@ -31,10 +31,10 @@ public class PayloadClientTest { @Test public void upgradeFormatTest() throws Exception { - String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}"; + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing_software_version\":\"existingVersion\",\"new_software_version\":\"newVersion\"}}"; JSONObject jsonObject = new JSONObject(); - jsonObject.put("existing-software-version", "existingVersion"); - jsonObject.put("new-software-version", "newVersion"); + jsonObject.put("existing_software_version", "existingVersion"); + jsonObject.put("new_software_version", "newVersion"); Optional<String> payload = Optional.of(jsonObject.toString()); Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); assertEquals(payloadResult, payloadClient.get()); @@ -51,7 +51,7 @@ public class PayloadClientTest { public void quiesceTrafficFormatTest() throws Exception { String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}"; JSONObject jsonObject = new JSONObject(); - jsonObject.put("operations-timeout", "operationTimeout"); + jsonObject.put("operations_timeout", "operationTimeout"); Optional<String> payload = Optional.of(jsonObject.toString()); Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); assertEquals(payloadResult, payloadClient.get()); @@ -78,4 +78,4 @@ public class PayloadClientTest { assertEquals(payloadResult, payloadClient.get()); } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 355dc15bbf..daa63044e4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -1459,14 +1459,20 @@ public class BBInputSetupTest { new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiCollection))); Collection collection = new Collection(); + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); List<InstanceGroup> instanceGroupsList = new ArrayList<>(); InstanceGroup instanceGroup = new InstanceGroup(); instanceGroupsList.add(instanceGroup); - + NetworkCollectionResourceCustomization networkCollectionCust = Mockito.mock(NetworkCollectionResourceCustomization.class); + CollectionResource collectionResource = new CollectionResource(); doReturn(collection).when(bbInputSetupMapperLayer) .mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class)); doReturn(instanceGroup).when(SPY_bbInputSetup).mapInstanceGroup(isA(AAIResultWrapper.class)); doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any()); + doReturn(networkCollectionCust).when(SPY_bbInputSetupUtils).getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + doReturn(collectionResource).when(networkCollectionCust).getCollectionResource(); + doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(networkCollectionCust, collectionResource); + SPY_bbInputSetup.mapCollection(collections, serviceInstance); assertEquals(collection, serviceInstance.getCollection()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index d576242318..db0f408010 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -736,7 +736,7 @@ public class BBInputSetupUtilsTest { volumeGroup.setVolumeGroupName("name123"); expected.get().getVolumeGroup().add(volumeGroup); doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "name123"); + Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "name123"); assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); } @@ -745,6 +745,7 @@ public class BBInputSetupUtilsTest { expectedException.expect(Exception.class); String vnfId = "vnfId"; + String volumeGroupId = "volumeGroupId"; String volumeGroupName = "volumeGroupName"; VolumeGroup volumeGroup = new VolumeGroup(); @@ -757,17 +758,18 @@ public class BBInputSetupUtilsTest { doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); } @Test public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception { String vnfId = "vnfId"; + String volumeGroupId = "volumeGroupId"; String volumeGroupName = "volumeGroupName"; doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); assertEquals(actualVolumeGroup, Optional.empty()); } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json index a500e0ba88..4a72cde73a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json @@ -1,5 +1,5 @@ { - "modelUUID":null, + "modelUUID":"modelVersionId", "modelName":null, "modelInvariantUUID":"modelInvariantUUID", "modelVersion":null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json index d87875da81..fc2ade75fb 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json @@ -1,5 +1,5 @@ { - "modelCustomizationUUID":null, + "modelCustomizationUUID":"modelCustomizationUUID", "modelInstanceName":null, "type":"type", "role":"role", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json index 45ca00bd32..a7e2ade10b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json @@ -1,4 +1,6 @@ { + "model-customization-uuid":"modelCustomizationUUID", + "model-version-id":"modelVersionId", "model-invariant-uuid":"modelInvariantUUID", "collection-function":"function", "collection-role":"role", diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn index 7691498bd0..3d18810e48 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="CreateVfModuleBB" name="CreateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="CreateVfModuleBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> @@ -28,7 +28,7 @@ <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" /> + <camunda:in source="VNFREST_Request" target="VNFREST_Request" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_16g4dz0</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index 408e378bcf..755bfe8126 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="DeleteVfModuleBB" name="Start" isExecutable="true"> <bpmn:startEvent id="DeleteVfModuleBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing> @@ -23,6 +23,7 @@ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" /> + <camunda:in source="VNFREST_Request" target="VNFREST_Request" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json index eb2d9faa2a..0a211e6b08 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json @@ -10,7 +10,7 @@ }, "requestParameters": { "payload": -"{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" +"{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file 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 diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json index 18b785cae5..57aea4d2bb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json @@ -32,7 +32,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json index bd114f7ad8..e876711c66 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json @@ -35,7 +35,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json index b1c9e65bba..c917a9504e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json @@ -36,7 +36,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json index 484f7bfc97..39cba3cfc8 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json @@ -29,7 +29,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json index 8562be02b8..dbf47112f3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json @@ -35,7 +35,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json index 476b9367c1..9a21a23ca0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json @@ -36,7 +36,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file |