diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-04-11 12:09:04 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-04-11 12:11:04 -0400 |
commit | 8b56e8d08070785152ba7c97e9a1878fa3652722 (patch) | |
tree | 0f5e016a62a9d81b9d38bb90dfd3475b355e8067 /asdc-controller/src/main | |
parent | 2aa56678b48362d87ae1eadfb9ab20737f83c3c6 (diff) |
Fix vFW Distrobution
Missing check to not reprocess service
Issue-ID: SO-1674
Change-Id: I152c61fb726eb8979eb30c8dcb5f4eed05fc4b8b
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'asdc-controller/src/main')
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. |