From 04650bbf354dd2c7c1880a92a8ee6d548ae9f074 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Fri, 11 May 2018 19:21:32 -0400 Subject: Remove requestId and instance append The requestId keeps creeping into this code. For the instance Id appending, we need a better strategy that conforms with robot test scripts in order to do multiple scale ups. Issue-ID: POLICY-793 Change-Id: Iab5d7608d5ee049cb6dd0508108bf77c2982db47 Signed-off-by: Pamela Dragosh --- .../actor/so/SOActorServiceProvider.java | 29 ++++++---------------- .../actor/so/TestSOActorServiceProvider.java | 1 - 2 files changed, 8 insertions(+), 22 deletions(-) (limited to 'controlloop/common') 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 4a1200a97..49b4e9885 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 @@ -20,15 +20,11 @@ package org.onap.policy.controlloop.actor.so; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; - import org.drools.core.WorkingMemory; import org.onap.policy.aai.AaiManager; import org.onap.policy.aai.AaiNqExtraProperty; @@ -57,6 +53,8 @@ import org.onap.policy.so.SORequestParameters; import org.onap.policy.so.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; public class SOActorServiceProvider implements Actor { private static final Logger logger = LoggerFactory.getLogger(SOActorServiceProvider.class); @@ -171,7 +169,9 @@ public class SOActorServiceProvider implements Actor { // Construct SO Request SORequest request = new SORequest(); - request.setRequestId(onset.getRequestId()); + // + // Do NOT send So the requestId, they do not support this field + // request.setRequestDetails(new SORequestDetails()); request.getRequestDetails().setModelInfo(new SOModelInfo()); request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); @@ -207,22 +207,8 @@ public class SOActorServiceProvider implements Actor { // // requestInfo // - 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().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"); @@ -384,6 +370,7 @@ public class SOActorServiceProvider implements Actor { * @return number of non base index modules */ + @SuppressWarnings("unused") private int findNonBaseModules(List inventoryResponseItems) { int nonBaseModuleCount = 0; for (AaiNqInventoryResponseItem invenoryResponseItem : inventoryResponseItems) { diff --git a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java index 0ef7c9f32..9d5ff6f77 100644 --- a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java +++ b/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/TestSOActorServiceProvider.java @@ -91,7 +91,6 @@ public class TestSOActorServiceProvider { SORequest request = new SOActorServiceProvider().constructRequest(onset, operation, policy); - assertEquals(requestId, request.getRequestId()); assertEquals("policy", request.getRequestDetails().getRequestInfo().getRequestorId()); assertEquals("RegionOne", request.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId()); } -- cgit 1.2.3-korg