aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java
diff options
context:
space:
mode:
authorElena Kuleshov <evn@att.com>2019-06-24 14:05:26 -0400
committerElena Kuleshov <evn@att.com>2019-06-24 14:06:56 -0400
commitac2b66be54faa91e6269e2ca4d2b5c08e8273feb (patch)
tree14198f2d7d6034dd40b91f02d9d7c2ec21ab357a /asdc-controller/src/main/java
parentcb7c5f2a4400515fa920f6dda0d8aa06603389d5 (diff)
Process workflow artifacts last
Workflow artifacts need to be processed last, check for existence of VNF resource Issue-ID: SO-2045 Signed-off-by: Kuleshov, Elena <evn@att.com> Change-Id: Ia46a6ecaef905287ce837c04b389ab2a13d3f24e
Diffstat (limited to 'asdc-controller/src/main/java')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java36
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java3
2 files changed, 28 insertions, 11 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
index a769b6a2e4..b3c7776c9a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
@@ -32,16 +32,19 @@ import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.so.asdc.installer.VfResourceStructure;
import org.onap.so.asdc.installer.WorkflowArtifact;
import org.onap.so.db.catalog.beans.ActivitySpec;
+import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceWorkflow;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence;
import org.onap.so.db.catalog.data.repository.ActivitySpecRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.data.repository.WorkflowRepository;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
@Component
@@ -60,20 +63,33 @@ public class WorkflowResource {
protected ActivitySpecRepository activityRepo;
@Autowired
+ protected VnfResourceRepository vnfResourceRepo;
+
+ @Autowired
private BpmnInstaller bpmnInstaller;
public void processWorkflows(VfResourceStructure vfResourceStructure) throws Exception {
Map<String, WorkflowArtifact> artifactsMapByUUID = vfResourceStructure.getWorkflowArtifactsMapByUUID();
- String vfResourceModelUuid = vfResourceStructure.getResourceInstance().getResourceUUID();
- for (String uuid : artifactsMapByUUID.keySet()) {
- WorkflowArtifact artifactToInstall = artifactsMapByUUID.get(uuid);
- if (isLatestVersionAvailable(artifactsMapByUUID, artifactToInstall)) {
- logger.debug("Installing the BPMN: " + artifactToInstall.getArtifactInfo().getArtifactName());
- deployWorkflowResourceToCamunda(artifactToInstall);
- installWorkflowResource(artifactToInstall, vfResourceModelUuid);
- } else {
- logger.debug("Skipping installing - not the latest version: "
- + artifactToInstall.getArtifactInfo().getArtifactName());
+ if (artifactsMapByUUID != null && !artifactsMapByUUID.isEmpty()) {
+ String vfResourceModelUuid = vfResourceStructure.getResourceInstance().getResourceUUID();
+ VnfResource vnfResource = vnfResourceRepo.findResourceByModelUUID(vfResourceModelUuid);
+ if (vnfResource == null) {
+ logger.debug("Failed deploying BPMN for vfResourceModelUUID {}", vfResourceModelUuid);
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(),
+ vfResourceModelUuid, vfResourceModelUuid, HttpStatus.NOT_FOUND, ErrorCode.DataError.getValue(),
+ "ASDC BPMN deploy failed");
+ throw (new Exception("VF Resource not present in Catalog DB: " + vfResourceModelUuid));
+ }
+ for (String uuid : artifactsMapByUUID.keySet()) {
+ WorkflowArtifact artifactToInstall = artifactsMapByUUID.get(uuid);
+ if (isLatestVersionAvailable(artifactsMapByUUID, artifactToInstall)) {
+ logger.debug("Installing the BPMN: " + artifactToInstall.getArtifactInfo().getArtifactName());
+ deployWorkflowResourceToCamunda(artifactToInstall);
+ installWorkflowResource(artifactToInstall, vfResourceModelUuid);
+ } else {
+ logger.debug("Skipping installing - not the latest version: "
+ + artifactToInstall.getArtifactInfo().getArtifactName());
+ }
}
}
}
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 6f0d2d7180..ca5cdf4fde 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
@@ -442,7 +442,6 @@ public class ToscaResourceInstaller {
vfCustomizationCategory);
}
- workflowResource.processWorkflows(vfResourceStructure);
processResourceSequence(toscaResourceStruct, service);
List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
processAllottedResources(toscaResourceStruct, service, allottedResourceList);
@@ -456,6 +455,8 @@ public class ToscaResourceInstaller {
service = serviceRepo.save(service);
correlateConfigCustomResources(service);
+ workflowResource.processWorkflows(vfResourceStructure);
+
WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(
vfResourceStruct.getNotification().getDistributionID(), MSO);
status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());