aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2019-08-02 21:17:09 +0530
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2019-08-26 20:23:46 +0530
commit713b2b8be4dd1dd57f5ef9b0927ceb9bd3b009c4 (patch)
treeaa011b7aefaf2fd89b38055c9204864535fdb97c /asdc-controller/src/main
parent392930581c3c981af482f006a11ac82ab2385ba1 (diff)
Fix parsing issue for ccvpn
Fix csar parsing issue for ccvpn. Change-Id: Ie99acbec8a52de7a08d1627c210c0e3fda986520 Issue-ID: SO-1393 Signed-off-by: sarada prasad sahoo <sarada.prasad.sahoo@huawei.com> Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'asdc-controller/src/main')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java7
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java44
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);
}