aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main
diff options
context:
space:
mode:
authorByung-Woo Jun <byung-woo.jun@est.tech>2019-04-11 18:03:42 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-11 18:03:42 +0000
commit70ab72a08c6d0a9976748806546c6ef04bc49f8e (patch)
tree5bd40f6b7e1dfc8edf849edeb7e2b62e02ed3a90 /asdc-controller/src/main
parent8e97a15510366a8348e60aeae367f5c75cf82aac (diff)
parent8b56e8d08070785152ba7c97e9a1878fa3652722 (diff)
Merge "Fix vFW Distrobution"
Diffstat (limited to 'asdc-controller/src/main')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java24
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java52
5 files changed, 24 insertions, 58 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 57e9c173b9..f2e875fc0c 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
@@ -655,6 +655,7 @@ public class ASDCController {
// For each artifact, create a structure describing the VFModule in a ordered flat level
ResourceStructure resourceStructure = null;
String msoConfigPath = getMsoConfigPath();
+ boolean hasVFResource = false;
ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure(msoConfigPath);
boolean deploySuccessful = true;
String errorMessage = null;
@@ -697,7 +698,7 @@ public class ASDCController {
+ resourceStructure.getResourceInstance().getResourceUUID());
if ("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)) {
-
+ hasVFResource = true;
for (IArtifactInfo artifact : resource.getArtifacts()) {
IDistributionClientDownloadResult resultArtifact =
this.downloadTheArtifact(artifact, iNotif.getDistributionID());
@@ -730,16 +731,19 @@ public class ASDCController {
logger.error("Exception occurred", e);
}
- // Deploy VF resource and artifacts
- logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
- try {
- this.deployResourceStructure(resourceStructure, toscaResourceStructure);
- } catch (ArtifactInstallerException e) {
- deploySuccessful = false;
- errorMessage = e.getMessage();
- logger.error("Exception occurred", e);
- }
+ if (!hasVFResource) {
+
+ logger.debug("No resources found for Service: " + iNotif.getServiceUUID());
+ logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
+ try {
+ this.deployResourceStructure(resourceStructure, toscaResourceStructure);
+ } catch (ArtifactInstallerException e) {
+ deploySuccessful = false;
+ errorMessage = e.getMessage();
+ logger.error("Exception occurred", e);
+ }
+ }
this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful,
errorMessage);
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
index b3618a8095..f4cfb1361f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
@@ -23,9 +23,11 @@ package org.onap.so.asdc.client.test.emulators;
import java.util.ArrayList;
import java.util.List;
import org.onap.sdc.api.notification.IArtifactInfo;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
+@JsonIgnoreProperties(ignoreUnknown = true)
public class ArtifactInfoImpl implements IArtifactInfo {
private String artifactName;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
index f8d7bb09f5..c61306fb77 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
@@ -29,12 +29,14 @@ import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
@Component
@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE,
setterVisibility = Visibility.NONE)
+@JsonIgnoreProperties(ignoreUnknown = true)
public class NotificationDataImpl implements INotificationData {
@JsonProperty("distributionID")
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
index 91597611fd..62d11ffec9 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
@@ -27,7 +27,9 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.IResourceInstance;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+@JsonIgnoreProperties(ignoreUnknown = true)
public class ResourceInfoImpl implements IResourceInstance {
public ResourceInfoImpl() {}
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 e61aafac2e..f3a495825c 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
@@ -261,7 +261,7 @@ public class ToscaResourceInstaller {
try {
Service existingService =
serviceRepo.findOneByModelUUID(vfResourceStructure.getNotification().getServiceUUID());
- if (existingService != null && serviceDeployed == false)
+ if (existingService != null && !serviceDeployed)
status = true;
if (status) {
logger.info(vfResourceStructure.getResourceInstance().getResourceInstanceName(),
@@ -387,12 +387,11 @@ public class ToscaResourceInstaller {
List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
try {
createToscaCsar(toscaResourceStruct);
- Service service = createService(toscaResourceStruct, vfResourceStruct);
+ createService(toscaResourceStruct, vfResourceStruct);
+ Service service = toscaResourceStruct.getCatalogService();
List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
-
for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
-
Metadata metadata = nodeTemplate.getMetaData();
String serviceType = toscaResourceStruct.getCatalogService().getServiceType();
String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper()
@@ -402,7 +401,6 @@ public class ToscaResourceInstaller {
}
processResourceSequence(toscaResourceStruct, service);
- processVFResources(toscaResourceStruct, service, vfResourceStructure);
List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
processAllottedResources(toscaResourceStruct, service, allottedResourceList);
processNetworks(toscaResourceStruct, service);
@@ -410,7 +408,7 @@ public class ToscaResourceInstaller {
processNetworkCollections(toscaResourceStruct, service);
// Process Service Proxy & Configuration
processServiceProxyAndConfiguration(toscaResourceStruct, service);
-
+ logger.info("Saving Service: {} ", service.getModelName());
serviceRepo.save(service);
WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(
@@ -763,48 +761,6 @@ public class ToscaResourceInstaller {
}
- protected void processVFResources(ToscaResourceStructure toscaResourceStruct, Service service,
- VfResourceStructure vfResourceStructure) throws Exception {
- logger.debug("processVFResources");
-
- List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
- // String servicecategory = toscaResourceStruct.getCatalogService().getCategory();
- // String serviceType = toscaResourceStruct.getCatalogService().getServiceType();
-
- for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
- Metadata metadata = nodeTemplate.getMetaData();
- String vfCustomizationCategory = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
- logger.debug("VF Category is : " + vfCustomizationCategory);
-
- // Do not treat Allotted Resources as VNF resources
- if (ALLOTTED_RESOURCE.equalsIgnoreCase(vfCustomizationCategory)) {
- continue;
- }
-
- String vfCustomizationUUID = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
-
- IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
-
- // Make sure the VF ResourceCustomizationUUID from the notification and tosca
- // customizations match before comparing their VF Modules UUID's
- logger.debug("Checking if Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: "
- + vfCustomizationUUID);
-
- if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
- + " matches vfNotificationResource CustomizationUUID");
-
- processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata,
- vfCustomizationCategory);
- } else {
- logger.debug("Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
- + "Tosca VF Customization UUID: " + vfCustomizationUUID);
- }
- }
- }
/**
* This is used to process the PNF specific resource, including resource and resource_customization.