diff options
author | Byung-Woo Jun <byung-woo.jun@est.tech> | 2019-08-26 16:03:39 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-26 16:03:39 +0000 |
commit | 6e3d7ef904de93d7d6b8ae4f043fa200ce802453 (patch) | |
tree | af254a4e69c1d8d32fb913feea06df8b75f445ec /asdc-controller/src/main | |
parent | a83fa219608559e1c9a82e4cfc5a345d6c3ec636 (diff) | |
parent | 713b2b8be4dd1dd57f5ef9b0927ceb9bd3b009c4 (diff) |
Merge "Fix parsing issue for ccvpn"
Diffstat (limited to 'asdc-controller/src/main')
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java | 7 | ||||
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java | 44 |
2 files changed, 34 insertions, 17 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 073412133c..90116ad4f5 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -742,8 +742,7 @@ public class ASDCController { logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID()); - if ("VF".equals(resourceType) && resource.getArtifacts() != null - && !resource.getArtifacts().isEmpty()) { + if ("VF".equals(resourceType)) { resourceStructure = new VfResourceStructure(iNotif, resource); } else if ("PNF".equals(resourceType)) { resourceStructure = new PnfResourceStructure(iNotif, resource); @@ -761,8 +760,8 @@ public class ASDCController { logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID()); - if ("VF".equals(resourceType) && resource.getArtifacts() != null - && !resource.getArtifacts().isEmpty()) { + + if ("VF".equals(resourceType)) { hasVFResource = true; for (IArtifactInfo artifact : resource.getArtifacts()) { IDistributionClientDownloadResult resultArtifact = 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 83827b425e..08aee1ab4e 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 @@ -437,20 +437,17 @@ public class ToscaResourceInstaller { List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); - List<IEntityDetails> arEntityDetails = new ArrayList<IEntityDetails>(); - for (IEntityDetails vfEntityDetails : vfEntityList) { Metadata metadata = vfEntityDetails.getMetadata(); - String category = metadata.getValue("category"); + String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); - if ("Allotted Resource".equalsIgnoreCase(category)) { - arEntityDetails.add(vfEntityDetails); + if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) { + continue; } processVfModules(vfEntityDetails, vfNodeTemplatesList.get(0), toscaResourceStruct, vfResourceStructure, service, metadata); - } processResourceSequence(toscaResourceStruct, service); @@ -667,6 +664,8 @@ public class ToscaResourceInstaller { } else { NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct, null, null, null, service); + networkCustomization.setResourceInput( + getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID())); service.getNetworkCustomizations().add(networkCustomization); logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for " + networkResourceModelName); @@ -677,11 +676,14 @@ public class ToscaResourceInstaller { } protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service, - List<NodeTemplate> allottedResourceList) { + List<NodeTemplate> allottedResourceList) throws ArtifactInstallerException { if (allottedResourceList != null) { for (NodeTemplate allottedNode : allottedResourceList) { - service.getAllottedCustomizations() - .add(createAllottedResource(allottedNode, toscaResourceStruct, service)); + AllottedResourceCustomization allottedResource = + createAllottedResource(allottedNode, toscaResourceStruct, service); + allottedResource.setResourceInput( + getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID())); + service.getAllottedCustomizations().add(allottedResource); } } } @@ -1370,7 +1372,14 @@ public class ToscaResourceInstaller { Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata(); - Service service = new Service(); + List<Service> services = + serviceRepo.findByModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + Service service; + if (!services.isEmpty() && services.size() > 0) { + service = services.get(0); + } else { + service = new Service(); + } if (serviceMetadata != null) { @@ -1482,7 +1491,14 @@ public class ToscaResourceInstaller { } protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) { - ToscaCsar toscaCsar = new ToscaCsar(); + Optional<ToscaCsar> toscaCsarOpt = + toscaCsarRepo.findById(toscaResourceStructure.getToscaArtifact().getArtifactUUID()); + ToscaCsar toscaCsar; + if (toscaCsarOpt.isPresent()) { + toscaCsar = toscaCsarOpt.get(); + } else { + toscaCsar = new ToscaCsar(); + } if (toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null) { toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum()); } else { @@ -2789,8 +2805,10 @@ public class ToscaResourceInstaller { if (!services.isEmpty()) { // service exist in db Service existingService = services.get(0); - List<VnfResourceCustomization> vnfCustomizations = existingService.getVnfCustomizations(); - vnfCustomizations.forEach(e -> service.getVnfCustomizations().add(e)); + List<VnfResourceCustomization> existingVnfCustomizations = existingService.getVnfCustomizations(); + if (existingService != null) { + service.getVnfCustomizations().addAll(existingVnfCustomizations); + } } service.getVnfCustomizations().add(vnfResourceCustomization); } |