summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java/org
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2020-01-30 14:10:45 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-30 14:10:45 +0000
commit79853158b8429307a97722bde2771dd4d7426385 (patch)
tree9b2dbb5681124fdc0a435c81e1c32e9bb6cc002e /bpmn/so-bpmn-tasks/src/main/java/org
parent6c2ebf59a8d198fe1213331bc1984022ac3bb8f3 (diff)
parentc0600706c4de333ff51a477a1211abef8b09834f (diff)
Merge "Create ActivatePnfBB"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java10
2 files changed, 30 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 86645391b4..f1fbe545ce 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
@@ -44,6 +45,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAICollectionResources;
import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIPnfResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
import org.onap.so.client.orchestration.AAIVnfResources;
@@ -78,6 +80,8 @@ public class AAIUpdateTasks {
private AAICollectionResources aaiCollectionResources;
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private AAIPnfResources aaiPnfResources;
/**
* BPMN access method to update the status of Service to Assigned in AAI
@@ -114,6 +118,22 @@ public class AAIUpdateTasks {
}
}
+
+ /**
+ * BPMN access method to update status of Pnf to Active in AAI
+ *
+ * @param execution
+ */
+ public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
+ try {
+ Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
+ aaiPnfResources.updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivePnf", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
/**
* BPMN access method to update status of Vnf to Assigned in AAI
*
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
index 9dd44c43e9..1dde814584 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
@@ -49,4 +49,14 @@ public class AAIPnfResources {
injectionHelper.getAaiClient().createIfNotExists(pnfURI, Optional.of(aaiObjectMapper.mapPnf(pnf)))
.connect(pnfURI, serviceInstanceURI);
}
+
+ public void updateOrchestrationStatusPnf(Pnf pnf, OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName());
+
+ Pnf pnfCopy = pnf.shallowCopyId();
+
+ pnf.setOrchestrationStatus(orchestrationStatus);
+ pnfCopy.setOrchestrationStatus(orchestrationStatus);
+ injectionHelper.getAaiClient().update(pnfURI, aaiObjectMapper.mapPnf(pnfCopy));
+ }
}