aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorRemigiusz Janeczek <remigiusz.janeczek@nokia.com>2020-01-29 14:44:42 +0100
committerRemigiusz Janeczek <remigiusz.janeczek@nokia.com>2020-01-30 14:12:00 +0100
commitc0600706c4de333ff51a477a1211abef8b09834f (patch)
tree97b591d4a97434891385a6f71dfa41f3cd41538d /bpmn/so-bpmn-tasks/src/main
parent76a37d03413fd1798e50274c57566c0ed3d752e4 (diff)
Create ActivatePnfBB
Issue-ID: SO-2607 Signed-off-by: Remigiusz Janeczek <remigiusz.janeczek@nokia.com> Change-Id: I1115defe4ddf417a7ea94f659cf2bea119029ebb
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-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));
+ }
}