summaryrefslogtreecommitdiffstats
path: root/controlloop/common/actors/actor.so
diff options
context:
space:
mode:
authorSwapnilPathak <SP00494485@techmahindra.com>2018-02-21 16:56:27 +0530
committerSwapnilPathak <SP00494485@techmahindra.com>2018-02-21 16:56:27 +0530
commitcfe2c6e071f5e43ad01f470a3c87230dd1e1fe13 (patch)
treeba0eecc458285f9d4d7954ee719805fe295c0502 /controlloop/common/actors/actor.so
parentdef0f11148b1fb0d97d4bfa16fc2224de0af7115 (diff)
Support vDNS scale out for multiple times
Generation of Unique values for attribute vf-module-name for every scale out operation Change-Id: I5274361c2f5a4136020a384dbe4a4009607f589a Issue-ID: POLICY-610 Signed-off-by: SwapnilPathak <SP00494485@techmahindra.com>
Diffstat (limited to 'controlloop/common/actors/actor.so')
-rw-r--r--controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
index 543114cad..4385ce272 100644
--- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
+++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
@@ -196,7 +196,22 @@ public class SOActorServiceProvider implements Actor {
//
// requestInfo
//
- request.getRequestDetails().getRequestInfo().setInstanceName(vnfItem.getItems().getInventoryResponseItems().get(baseIndex).getVfModule().getVfModuleName().replace("Vfmodule", "vDNS"));
+ String instanceName = vnfItem.getItems().getInventoryResponseItems().get(baseIndex).getVfModule()
+ .getVfModuleName().replace("Vfmodule", "vDNS");
+ int numberOfNonBaseModules = findNonBaseModules(vnfItem.getItems().getInventoryResponseItems());
+ // Code to create unique VF Module names across the invocations.
+ if (numberOfNonBaseModules == 1) {
+ int instanceNumber = 1;
+ instanceName = instanceName.concat("-").concat(String.valueOf(instanceNumber));
+ request.getRequestDetails().getRequestInfo().setInstanceName(instanceName);
+ } else if (numberOfNonBaseModules > 1) {
+ int instanceNumber = numberOfNonBaseModules + 1;
+ instanceName = instanceName.concat("-").concat(String.valueOf(instanceNumber));
+ request.getRequestDetails().getRequestInfo().setInstanceName(instanceName);
+ } else {
+ request.getRequestDetails().getRequestInfo().setInstanceName(vnfItem.getItems().getInventoryResponseItems()
+ .get(baseIndex).getVfModule().getVfModuleName().replace("Vfmodule", "vDNS"));
+ }
request.getRequestDetails().getRequestInfo().setSource("POLICY");
request.getRequestDetails().getRequestInfo().setSuppressRollback(false);
request.getRequestDetails().getRequestInfo().setRequestorId("policy");
@@ -324,6 +339,24 @@ public class SOActorServiceProvider implements Actor {
return -1;
}
+
+ /**
+ * Find the number of non base modules present in API response object.
+ *
+ * @param inventoryResponseItems
+ * @return number of non base index modules
+ */
+
+ private int findNonBaseModules(List<AAINQInventoryResponseItem> inventoryResponseItems) {
+ int nonBaseModuleCount = 0;
+ for (AAINQInventoryResponseItem invenoryResponseItem : inventoryResponseItems) {
+ if (invenoryResponseItem.getVfModule() != null
+ && (!invenoryResponseItem.getVfModule().getIsBaseVfModule())) {
+ nonBaseModuleCount++;
+ }
+ }
+ return nonBaseModuleCount;
+ }
/**
* This method is called to remember the last service instance ID and VNF Item VNF ID. Note these fields are static, beware for multithreaded deployments