aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2019-04-20 16:20:08 +0530
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2019-04-20 16:20:08 +0530
commit7f8b940085bd6b42cc9dd08d5c71091425542586 (patch)
tree26c2ac055c0a1a11b07e191c4d22bf0dd31a9270 /asdc-controller
parent0a355f91e1da586f70450329d8620b823d59b9e5 (diff)
Add existing vnf customization for service
Add existing vnf customiation for service if they are exit in db. Otherwise vnf_resource_customization_to_service will hold only last process VF while parsing. Change-Id: I52ea9dec58630e61eae88e7c9325aa37d64c00d6 Issue-ID: SO-1805 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java16
1 files changed, 15 insertions, 1 deletions
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 50a555882d..aba70f33e3 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
@@ -984,7 +984,8 @@ public class ToscaResourceInstaller {
}
- service.getVnfCustomizations().add(vnfResource);
+ // add this vnfResource with existing vnfResource for this service
+ addVnfCustomization(service, vnfResource);
} else {
logger.debug("Notification VF ResourceCustomizationUUID: "
+ vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
@@ -2440,6 +2441,19 @@ public class ToscaResourceInstaller {
return inputName;
}
+ // this method add provided vnfCustomization to service with
+ // existing customization available in db.
+ private void addVnfCustomization(Service service, VnfResourceCustomization vnfResourceCustomization) {
+ List<Service> services = serviceRepo.findByModelUUID(service.getModelUUID());
+ if (services.size() > 0) {
+ // service exist in db
+ Service existingService = services.get(0);
+ List<VnfResourceCustomization> vnfCustomizations = existingService.getVnfCustomizations();
+ vnfCustomizations.forEach(e -> service.getVnfCustomizations().add(e));
+ }
+ service.getVnfCustomizations().add(vnfResourceCustomization);
+ }
+
protected static Timestamp getCurrentTimeStamp() {