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 /bpmn/MSOCommonBPMN/src | |
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>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
13 files changed, 62 insertions, 26 deletions
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", |