summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-07-29 13:50:40 -0400
committerJim Hahn <jrh3@att.com>2020-07-31 14:08:17 -0400
commitacded8235dcbb0b06abaa98297fecef78b4eec41 (patch)
tree8b400d09875cd2c6f7844fbbe0c4d9e1e1a16230
parent1da24b28d9df7c8ad5154d7788dab0ab9da589f8 (diff)
Add property lists to Actors
Modified the Actor code to provide a list of properties needed by the actor to perform a given operation. Added a build() method to the parameter class so invokers can build an operation and set its properties prior to starting it. Added a "preprocessed" field to the parameter class so invokers can indicate that the Actor need not perform any preprocessing steps. Will modify the actors, in a subsequent review, to observe the flag. Added "properties" to Operation so invokers can set the properties. Will modify the actors, in a subsequent review, to use the property values instead of the event context. Tweaked a few Actors to get values using the "params" object instead of reaching inside to the event object that it contains. Addressed review comment(s): - add prefix to other property names Issue-ID: POLICY-2746 Change-Id: I65996aef5cec5afe25e8287c0b2f5f322c532ca5 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java3
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java6
-rw-r--r--models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java6
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java3
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java8
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java11
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java26
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java40
-rw-r--r--models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java3
-rw-r--r--models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java14
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java12
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java6
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java16
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java13
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java3
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java13
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java8
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java5
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java13
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java13
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java13
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java16
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java16
-rw-r--r--models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java16
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java15
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java16
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java63
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java5
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java7
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java34
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java20
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java3
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java8
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java10
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java3
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java5
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java3
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java25
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java17
45 files changed, 489 insertions, 64 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
index 718047cfc..caa8b9e1f 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
@@ -36,6 +37,7 @@ import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
@@ -57,6 +59,8 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
public static final String RESOURCE_LINK = "resource-link";
public static final String RESULT_DATA = "result-data";
+ private static final List<String> PROPERTY_NAMES = List.of(OperationProperties.AAI_VSERVER_LINK);
+
// TODO make this configurable
private static final String PREFIX = "/aai/v16";
@@ -70,7 +74,7 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
* @param config configuration for this operation
*/
public AaiCustomQueryOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, String.class);
+ super(params, config, String.class, PROPERTY_NAMES);
this.vserver = params.getContext().getEnrichment().get(VSERVER_VSERVER_NAME);
if (StringUtils.isBlank(this.vserver)) {
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
index 07738b084..c18d06c95 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
@@ -58,7 +59,7 @@ public class AaiGetOperation extends HttpOperation<StandardCoderObject> {
* @param config configuration for this operation
*/
public AaiGetOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, StandardCoderObject.class);
+ super(params, config, StandardCoderObject.class, Collections.emptyList());
this.propertyPrefix = getFullName() + ".";
}
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
index 173eb2908..400096507 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
@@ -51,6 +51,7 @@ import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.Util;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator;
@@ -140,6 +141,11 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation {
}
@Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_VSERVER_LINK));
+ }
+
+ @Test
public void testGenerateSubRequestId() {
oper.generateSubRequestId(3);
assertEquals("3", oper.getSubRequestId());
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
index 042b64f60..b211db261 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -79,6 +80,11 @@ public class AaiGetPnfOperationTest extends BasicAaiOperation {
assertEquals(AaiGetPnfOperation.NAME, oper.getName());
}
+ @Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEmpty();
+ }
+
/**
* Tests "success" case with simulator.
*/
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
index be8a26416..fe0327c10 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -79,6 +80,11 @@ public class AaiGetTenantOperationTest extends BasicAaiOperation {
assertEquals(AaiGetTenantOperation.NAME, oper.getName());
}
+ @Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEmpty();
+ }
+
/**
* Tests "success" case with simulator.
*/
diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
index 9af24185c..e07093ae6 100644
--- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
+++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
@@ -63,9 +63,11 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request,
*
* @param params operation parameters
* @param config configuration for this operation
+ * @param propertyNames names of properties required by this operation
*/
- public AppcOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config) {
- super(params, config, Response.class);
+ public AppcOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config,
+ List<String> propertyNames) {
+ super(params, config, Response.class, propertyNames);
}
/**
diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java
index a318444aa..d1f27b505 100644
--- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java
+++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperation.java
@@ -20,12 +20,14 @@
package org.onap.policy.controlloop.actor.appc;
+import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.policy.aai.AaiConstants;
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.appc.Request;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.slf4j.Logger;
@@ -36,6 +38,8 @@ public class ModifyConfigOperation extends AppcOperation {
public static final String NAME = "ModifyConfig";
+ private static final List<String> PROPERTY_NAMES = List.of(OperationProperties.AAI_RESOURCE_VNF);
+
/**
* Constructs the object.
*
@@ -43,7 +47,7 @@ public class ModifyConfigOperation extends AppcOperation {
* @param config configuration for this operation
*/
public ModifyConfigOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config) {
- super(params, config);
+ super(params, config, PROPERTY_NAMES);
}
/**
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
index b2d012a9f..e544d46cb 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
import org.junit.After;
@@ -234,7 +235,7 @@ public class AppcOperationTest extends BasicAppcOperation {
private static class MyOper extends AppcOperation {
public MyOper(ControlLoopOperationParams params, BidirectionalTopicConfig config) {
- super(params, config);
+ super(params, config, Collections.emptyList());
}
@Override
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
index 0e29dd208..d000038e3 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.appc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -32,6 +33,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Arrays;
+import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.After;
@@ -45,6 +47,7 @@ import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams;
@@ -119,6 +122,11 @@ public class ModifyConfigOperationTest extends BasicAppcOperation {
}
@Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_RESOURCE_VNF));
+ }
+
+ @Test
public void testStartPreprocessorAsync() throws Exception {
CompletableFuture<OperationOutcome> future2 = new CompletableFuture<>();
context = mock(ControlLoopEventContext.class);
diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
index 0be723c7c..590bf1968 100644
--- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
+++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.appclcm;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@@ -32,7 +33,6 @@ import org.onap.policy.appclcm.AppcLcmOutput;
import org.onap.policy.appclcm.AppcLcmResponseCode;
import org.onap.policy.appclcm.AppcLcmResponseStatus;
import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
@@ -62,7 +62,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
* @param config configuration for this operation
*/
public AppcLcmOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config) {
- super(params, config, AppcLcmDmaapWrapper.class);
+ super(params, config, AppcLcmDmaapWrapper.class, Collections.emptyList());
if (StringUtils.isBlank(params.getTargetEntity())) {
throw new IllegalArgumentException("missing targetEntity");
@@ -80,12 +80,11 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
@Override
protected AppcLcmDmaapWrapper makeRequest(int attempt) {
- VirtualControlLoopEvent onset = params.getContext().getEvent();
String subRequestId = getSubRequestId();
AppcLcmCommonHeader header = new AppcLcmCommonHeader();
- header.setOriginatorId(onset.getRequestId().toString());
- header.setRequestId(onset.getRequestId());
+ header.setOriginatorId(params.getRequestId().toString());
+ header.setRequestId(params.getRequestId());
header.setSubRequestId(subRequestId);
AppcLcmInput inputRequest = new AppcLcmInput();
@@ -118,7 +117,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
AppcLcmDmaapWrapper dmaapRequest = new AppcLcmDmaapWrapper();
dmaapRequest.setBody(body);
dmaapRequest.setVersion("2.0");
- dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + subRequestId);
+ dmaapRequest.setCorrelationId(params.getRequestId() + "-" + subRequestId);
dmaapRequest.setRpcName(recipeFormatter.getUrlRecipe());
dmaapRequest.setType("request");
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
index 6059cb5ed..705fd105f 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.appclcm;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -142,6 +143,11 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
}
@Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEmpty();
+ }
+
+ @Test
public void testStartPreprocessorAsync() throws Exception {
context = mock(ControlLoopEventContext.class);
when(context.getEvent()).thenReturn(event);
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
index 0a882ce93..241781254 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java
@@ -25,8 +25,10 @@ import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Struct;
import com.google.protobuf.Struct.Builder;
import com.google.protobuf.util.JsonFormat;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
@@ -48,6 +50,7 @@ import org.onap.policy.controlloop.actor.aai.AaiGetPnfOperation;
import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants;
import org.onap.policy.controlloop.actor.cds.request.CdsActionRequest;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.Util;
import org.onap.policy.controlloop.actorserviceprovider.impl.OperationPartial;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
@@ -84,6 +87,19 @@ public class GrpcOperation extends OperationPartial {
*/
private final Supplier<Map<String, String>> aaiConverter;
+
+ // @formatter:off
+ private static final List<String> PNF_PROPERTY_NAMES = List.of(
+ OperationProperties.AAI_PNF,
+ OperationProperties.EVENT_ADDITIONAL_PARAMS);
+
+
+ private static final List<String> VNF_PROPERTY_NAMES = List.of(
+ OperationProperties.AAI_MODEL_INVARIANT_GENERIC_VNF,
+ OperationProperties.AAI_RESOURCE_SERVICE_INSTANCE,
+ OperationProperties.EVENT_ADDITIONAL_PARAMS);
+ // @formatter:on
+
/**
* Constructs the object.
*
@@ -91,7 +107,7 @@ public class GrpcOperation extends OperationPartial {
* @param config configuration for this operation
*/
public GrpcOperation(ControlLoopOperationParams params, GrpcConfig config) {
- super(params, config);
+ super(params, config, Collections.emptyList());
this.config = config;
if (TargetType.PNF.equals(params.getTarget().getType())) {
@@ -103,6 +119,11 @@ public class GrpcOperation extends OperationPartial {
}
}
+ @Override
+ public List<String> getPropertyNames() {
+ return (TargetType.PNF.equals(params.getTarget().getType()) ? PNF_PROPERTY_NAMES : VNF_PROPERTY_NAMES);
+ }
+
/**
* If no timeout is specified, then it returns the operator's configured timeout.
*/
@@ -287,8 +308,7 @@ public class GrpcOperation extends OperationPartial {
// Build CDS gRPC request common-header
CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(CdsActorConstants.ORIGINATOR_ID)
- .setRequestId(params.getContext().getEvent().getRequestId().toString())
- .setSubRequestId(getSubRequestId()).build();
+ .setRequestId(params.getRequestId().toString()).setSubRequestId(getSubRequestId()).build();
// Build CDS gRPC request action-identifier
ActionIdentifiers actionIdentifiers =
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
index fe8d42814..cbc88a30e 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
@@ -19,6 +19,7 @@
package org.onap.policy.controlloop.actor.cds;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -30,6 +31,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@@ -62,6 +64,7 @@ import org.onap.policy.controlloop.actor.aai.AaiGetPnfOperation;
import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants;
import org.onap.policy.controlloop.actorserviceprovider.ActorService;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.policy.PolicyResult;
@@ -171,6 +174,43 @@ public class GrpcOperationTest {
}
@Test
+ public void testGetPropertyNames() {
+ ControlLoopEventContext context = mock(ControlLoopEventContext.class);
+ when(context.getEvent()).thenReturn(onset);
+
+ ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR)
+ .operation(GrpcOperation.NAME).context(context).actorService(new ActorService())
+ .targetEntity(TARGET_ENTITY).target(target).build();
+ GrpcConfig config = new GrpcConfig(executor, cdsProps);
+
+ /*
+ * check VNF case
+ */
+ operation = new GrpcOperation(params, config);
+
+ // @formatter:off
+ assertThat(operation.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.AAI_MODEL_INVARIANT_GENERIC_VNF,
+ OperationProperties.AAI_RESOURCE_SERVICE_INSTANCE,
+ OperationProperties.EVENT_ADDITIONAL_PARAMS));
+ // @formatter:on
+
+ /*
+ * check PNF case
+ */
+ target.setType(TargetType.PNF);
+ operation = new GrpcOperation(params, config);
+
+ // @formatter:off
+ assertThat(operation.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.AAI_PNF,
+ OperationProperties.EVENT_ADDITIONAL_PARAMS));
+ // @formatter:on
+ }
+
+ @Test
public void testStartPreprocessorAsync() throws InterruptedException, ExecutionException, TimeoutException {
CompletableFuture<OperationOutcome> future2 = new CompletableFuture<>();
diff --git a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
index 6a7b6fd93..bd4f0e3b6 100644
--- a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
+++ b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.guard;
+import java.util.Collections;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
@@ -81,7 +82,7 @@ public class DecisionOperation extends HttpOperation<DecisionResponse> {
* @param config configuration for this operation
*/
public DecisionOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, DecisionResponse.class);
+ super(params, config, DecisionResponse.class, Collections.emptyList());
this.config = (GuardConfig) config;
}
diff --git a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
index 6fe8ceac2..ac6d6c8e3 100644
--- a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
+++ b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/DecisionOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.guard;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -148,6 +149,11 @@ public class DecisionOperationTest extends BasicHttpOperation {
}
@Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEmpty();
+ }
+
+ @Test
public void testStartOperationAsync() throws Exception {
CompletableFuture<OperationOutcome> future2 = oper.start();
executor.runAll(100);
diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java
index 0c44169e1..434b3b985 100644
--- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java
+++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperation.java
@@ -20,7 +20,9 @@
package org.onap.policy.controlloop.actor.sdnc;
+import java.util.List;
import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
@@ -42,6 +44,14 @@ public class BandwidthOnDemandOperation extends SdncOperation {
public static final String SERVICE_ID_KEY = "service-instance.service-instance-id";
public static final String VNF_ID = "vnfId";
+ // @formatter:off
+ private static final List<String> PROPERTY_NAMES = List.of(
+ OperationProperties.ENRICHMENT_SERVICE_INSTANCE_ID,
+ OperationProperties.ENRICHMENT_BANDWIDTH,
+ OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME,
+ OperationProperties.ENRICHMENT_VNF_ID);
+ // @formatter:on
+
/**
* Constructs the object.
*
@@ -49,7 +59,7 @@ public class BandwidthOnDemandOperation extends SdncOperation {
* @param config configuration for this operation
*/
public BandwidthOnDemandOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config);
+ super(params, config, PROPERTY_NAMES);
}
@Override
@@ -88,7 +98,7 @@ public class BandwidthOnDemandOperation extends SdncOperation {
SdncRequest request = new SdncRequest();
request.setNsInstanceId(serviceInstance);
- request.setRequestId(context.getRequestId());
+ request.setRequestId(params.getRequestId());
request.setUrl("/" + getPath());
SdncHealVnfInfo vnfInfo = new SdncHealVnfInfo();
diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java
index d8e1b0548..d26fad8c7 100644
--- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java
+++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperation.java
@@ -20,7 +20,9 @@
package org.onap.policy.controlloop.actor.sdnc;
+import java.util.List;
import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
@@ -38,6 +40,12 @@ public class RerouteOperation extends SdncOperation {
public static final String SERVICE_ID_KEY = "service-instance.service-instance-id";
public static final String NETWORK_ID_KEY = "network-information.network-id";
+ // @formatter:off
+ private static final List<String> PROPERTY_NAMES = List.of(
+ OperationProperties.ENRICHMENT_SERVICE_ID,
+ OperationProperties.ENRICHMENT_NETWORK_ID);
+ // @formatter:on
+
/**
* Constructs the object.
*
@@ -45,7 +53,7 @@ public class RerouteOperation extends SdncOperation {
* @param config configuration for this operation
*/
public RerouteOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config);
+ super(params, config, PROPERTY_NAMES);
}
@Override
@@ -75,7 +83,7 @@ public class RerouteOperation extends SdncOperation {
SdncRequest request = new SdncRequest();
request.setNsInstanceId(serviceInstance);
- request.setRequestId(context.getRequestId());
+ request.setRequestId(params.getRequestId());
request.setUrl("/" + getPath());
SdncHealRequest healRequest = new SdncHealRequest();
diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java
index 9b6394315..4d8e35e71 100644
--- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java
+++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.sdnc;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.client.Entity;
@@ -44,9 +45,10 @@ public abstract class SdncOperation extends HttpOperation<SdncResponse> {
*
* @param params operation parameters
* @param config configuration for this operation
+ * @param propertyNames names of properties required by this operation
*/
- public SdncOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, SdncResponse.class);
+ public SdncOperation(ControlLoopOperationParams params, HttpConfig config, List<String> propertyNames) {
+ super(params, config, SdncResponse.class, propertyNames);
}
/**
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
index 95b4bd739..56b64e491 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
@@ -20,15 +20,18 @@
package org.onap.policy.controlloop.actor.sdnc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.List;
import java.util.Map;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
@@ -68,6 +71,19 @@ public class BandwidthOnDemandOperationTest extends BasicSdncOperation {
assertEquals(BandwidthOnDemandOperation.NAME, oper.getName());
}
+ @Test
+ public void testGetPropertyNames() {
+ // @formatter:off
+ assertThat(oper.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.ENRICHMENT_SERVICE_INSTANCE_ID,
+ OperationProperties.ENRICHMENT_BANDWIDTH,
+ OperationProperties.ENRICHMENT_BANDWIDTH_CHANGE_TIME,
+ OperationProperties.ENRICHMENT_VNF_ID));
+
+ // @formatter:on
+ }
+
/**
* Tests "success" case with simulator.
*/
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
index 142f10743..9f06805f6 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
@@ -20,15 +20,18 @@
package org.onap.policy.controlloop.actor.sdnc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.List;
import java.util.Map;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
@@ -86,6 +89,16 @@ public class RerouteOperationTest extends BasicSdncOperation {
}
@Test
+ public void testGetPropertyNames() {
+ // @formatter:off
+ assertThat(oper.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.ENRICHMENT_SERVICE_ID,
+ OperationProperties.ENRICHMENT_NETWORK_ID));
+ // @formatter:on
+ }
+
+ @Test
public void testMakeRequest() throws Exception {
oper.generateSubRequestId(1);
SdncRequest request = oper.makeRequest(1);
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java
index 417029d49..fb9f71b05 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncOperationTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
import org.junit.Before;
@@ -57,7 +58,7 @@ public class SdncOperationTest extends BasicSdncOperation {
healRequest.setRequestHeaderInfo(headerInfo);
headerInfo.setSvcRequestId(SUB_REQ_ID);
- oper = new SdncOperation(params, config) {
+ oper = new SdncOperation(params, config, Collections.emptyList()) {
@Override
protected SdncRequest makeRequest(int attempt) {
return request;
diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
index 6c8f45d94..f88f3c300 100644
--- a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
+++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
@@ -22,8 +22,8 @@ package org.onap.policy.controlloop.actor.sdnr;
import java.util.List;
import java.util.concurrent.CompletableFuture;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
@@ -46,6 +46,8 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
*/
public static final String NAME = "any";
+ private static final List<String> PROPERTY_NAMES = List.of(OperationProperties.AAI_VSERVER_LINK);
+
/**
* Keys used to match the response with the request listener. The sub request ID is a
* UUID, so it can be used to uniquely identify the response.
@@ -57,7 +59,7 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
List.of(new SelectorKey("body", "output", "CommonHeader", "SubRequestID"));
public SdnrOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config) {
- super(params, config, PciMessage.class);
+ super(params, config, PciMessage.class, PROPERTY_NAMES);
}
/**
@@ -135,14 +137,13 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
@Override
protected PciMessage makeRequest(int attempt) {
- VirtualControlLoopEvent onset = params.getContext().getEvent();
String subRequestId = getSubRequestId();
/* Construct an SDNR request using pci Model */
PciMessage dmaapRequest = new PciMessage();
dmaapRequest.setVersion("1.0");
- dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + subRequestId);
+ dmaapRequest.setCorrelationId(params.getRequestId() + "-" + subRequestId);
dmaapRequest.setType("request");
dmaapRequest.setRpcName(params.getOperation().toLowerCase());
@@ -151,11 +152,11 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
/* The common header is a required field for all SDNR requests. */
PciCommonHeader requestCommonHeader = new PciCommonHeader();
- requestCommonHeader.setRequestId(onset.getRequestId());
+ requestCommonHeader.setRequestId(params.getRequestId());
requestCommonHeader.setSubRequestId(subRequestId);
sdnrRequest.setCommonHeader(requestCommonHeader);
- sdnrRequest.setPayload(onset.getPayload());
+ sdnrRequest.setPayload(params.getContext().getEvent().getPayload());
sdnrRequest.setAction(params.getOperation());
/*
diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
index 7e9d263ad..8ec1e4a20 100644
--- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.sdnr;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -29,6 +30,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Arrays;
+import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.After;
@@ -38,6 +40,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation.Status;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
@@ -86,6 +89,11 @@ public class SdnrOperationTest extends BasicSdnrOperation {
}
@Test
+ public void testGetPropertyNames() {
+ assertThat(operation.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_VSERVER_LINK));
+ }
+
+ @Test
public void testMakeRequest() {
operation.generateSubRequestId(1);
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
index cb9ec9c40..f269ea078 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
@@ -86,9 +86,10 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
*
* @param params operation parameters
* @param config configuration for this operation
+ * @param propertyNames names of properties required by this operation
*/
- public SoOperation(ControlLoopOperationParams params, HttpPollingConfig config) {
- super(params, config, SoResponse.class);
+ public SoOperation(ControlLoopOperationParams params, HttpPollingConfig config, List<String> propertyNames) {
+ super(params, config, SoResponse.class, propertyNames);
setUsePolling();
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
index c56bc222f..fcd48b1a5 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.so;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.client.Entity;
@@ -35,6 +36,7 @@ import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.so.SoModelInfo;
@@ -57,6 +59,15 @@ public class VfModuleCreate extends SoOperation {
private static final String PATH_PREFIX = "/";
+ // @formatter:off
+ private static final List<String> PROPERTY_NAMES = List.of(
+ OperationProperties.AAI_MODEL_SERVICE,
+ OperationProperties.AAI_MODEL_VNF,
+ OperationProperties.AAI_MODEL_CLOUD_REGION,
+ OperationProperties.AAI_MODEL_TENANT,
+ OperationProperties.DATA_VF_COUNT);
+ // @formatter:off
+
/**
* Constructs the object.
*
@@ -64,7 +75,7 @@ public class VfModuleCreate extends SoOperation {
* @param config configuration for this operation
*/
public VfModuleCreate(ControlLoopOperationParams params, HttpPollingConfig config) {
- super(params, config);
+ super(params, config, PROPERTY_NAMES);
// ensure we have the necessary parameters
validateTarget();
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
index dc8b0d606..b7afb696c 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java
@@ -28,6 +28,7 @@ import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
@@ -46,6 +47,7 @@ import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.controlloop.actorserviceprovider.pipeline.PipelineControllerFuture;
@@ -66,6 +68,15 @@ public class VfModuleDelete extends SoOperation {
private static final String PATH_PREFIX = "/";
+ // @formatter:off
+ private static final List<String> PROPERTY_NAMES = List.of(
+ OperationProperties.AAI_MODEL_SERVICE,
+ OperationProperties.AAI_MODEL_VNF,
+ OperationProperties.AAI_MODEL_CLOUD_REGION,
+ OperationProperties.AAI_MODEL_TENANT,
+ OperationProperties.DATA_VF_COUNT);
+ // @formatter:on
+
/**
* Constructs the object.
*
@@ -73,7 +84,7 @@ public class VfModuleDelete extends SoOperation {
* @param config configuration for this operation
*/
public VfModuleDelete(ControlLoopOperationParams params, HttpPollingConfig config) {
- super(params, config);
+ super(params, config, PROPERTY_NAMES);
// ensure we have the necessary parameters
validateTarget();
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
index 46d96fded..7314c59fa 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
@@ -60,6 +60,9 @@ public class SoOperationTest extends BasicSoOperation {
private static final String VF_COUNT_KEY = SoConstants.VF_COUNT_PREFIX
+ "[my-model-customization-id][my-model-invariant-id][my-model-version-id]";
+
+ private static final List<String> PROP_NAMES = Collections.emptyList();
+
private SoOperation oper;
/**
@@ -71,7 +74,7 @@ public class SoOperationTest extends BasicSoOperation {
initConfig();
- oper = new SoOperation(params, config) {};
+ oper = new SoOperation(params, config, PROP_NAMES) {};
}
@Test
@@ -83,7 +86,7 @@ public class SoOperationTest extends BasicSoOperation {
// check when Target is null
params = params.toBuilder().target(null).build();
- assertThatIllegalArgumentException().isThrownBy(() -> new SoOperation(params, config) {})
+ assertThatIllegalArgumentException().isThrownBy(() -> new SoOperation(params, config, PROP_NAMES) {})
.withMessageContaining("Target information");
}
@@ -222,7 +225,7 @@ public class SoOperationTest extends BasicSoOperation {
// try with null target
params = params.toBuilder().target(null).build();
- assertThatIllegalArgumentException().isThrownBy(() -> new SoOperation(params, config) {})
+ assertThatIllegalArgumentException().isThrownBy(() -> new SoOperation(params, config, PROP_NAMES) {})
.withMessageContaining("missing Target");
}
@@ -258,7 +261,7 @@ public class SoOperationTest extends BasicSoOperation {
// null payload
params = params.toBuilder().payload(null).build();
- oper = new SoOperation(params, config) {};
+ oper = new SoOperation(params, config, PROP_NAMES) {};
assertTrue(oper.buildRequestParameters().isEmpty());
}
@@ -278,7 +281,7 @@ public class SoOperationTest extends BasicSoOperation {
// null payload
params = params.toBuilder().payload(null).build();
- oper = new SoOperation(params, config) {};
+ oper = new SoOperation(params, config, PROP_NAMES) {};
assertTrue(oper.buildConfigurationParameters().isEmpty());
}
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
index 94268646d..0db209dad 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.so;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -30,6 +31,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
@@ -50,6 +52,7 @@ import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams;
@@ -116,6 +119,19 @@ public class VfModuleCreateTest extends BasicSoOperation {
}
@Test
+ public void testGetPropertyNames() {
+ // @formatter:off
+ assertThat(oper.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.AAI_MODEL_SERVICE,
+ OperationProperties.AAI_MODEL_VNF,
+ OperationProperties.AAI_MODEL_CLOUD_REGION,
+ OperationProperties.AAI_MODEL_TENANT,
+ OperationProperties.DATA_VF_COUNT));
+ // @formatter:on
+ }
+
+ @Test
public void testStartPreprocessorAsync() throws Exception {
// insert CQ data so it's there for the check
context.setProperty(AaiCqResponse.CONTEXT_KEY, makeCqResponse());
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
index d7b53411b..7c37dc900 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.so;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -39,6 +40,7 @@ import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
@@ -63,6 +65,7 @@ import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams;
@@ -145,6 +148,19 @@ public class VfModuleDeleteTest extends BasicSoOperation {
}
@Test
+ public void testGetPropertyNames() {
+ // @formatter:off
+ assertThat(oper.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.AAI_MODEL_SERVICE,
+ OperationProperties.AAI_MODEL_VNF,
+ OperationProperties.AAI_MODEL_CLOUD_REGION,
+ OperationProperties.AAI_MODEL_TENANT,
+ OperationProperties.DATA_VF_COUNT));
+ // @formatter:on
+ }
+
+ @Test
public void testStartPreprocessorAsync() throws Exception {
// insert CQ data so it's there for the check
context.setProperty(AaiCqResponse.CONTEXT_KEY, makeCqResponse());
diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
index d5ee44a5d..8bd4630d6 100644
--- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
+++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
@@ -20,10 +20,12 @@
package org.onap.policy.controlloop.actor.vfc;
+import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
@@ -44,6 +46,14 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> {
public static final String REQ_PARAM_NM = "requestParameters";
public static final String CONFIG_PARAM_NM = "configurationParameters";
+ // @formatter:off
+ private static final List<String> PROPERTY_NAMES = List.of(
+ OperationProperties.ENRICHMENT_SERVICE_INSTANCE_ID,
+ OperationProperties.ENRICHMENT_VSERVER_ID,
+ OperationProperties.ENRICHMENT_VSERVER_NAME,
+ OperationProperties.ENRICHMENT_GENERIC_VNF_ID);
+ // @formatter:on
+
/**
* Job ID extracted from the first response.
*/
@@ -57,7 +67,7 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> {
* @param config configuration for this operation
*/
public VfcOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, VfcResponse.class);
+ super(params, config, VfcResponse.class, PROPERTY_NAMES);
setUsePolling();
}
@@ -180,14 +190,14 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> {
additionalParams.setActionInfo(vmActionInfo);
VfcHealRequest healRequest = new VfcHealRequest();
- healRequest.setVnfInstanceId(params.getContext().getEvent().getAai().get(GENERIC_VNF_ID));
+ healRequest.setVnfInstanceId(params.getContext().getEnrichment().get(GENERIC_VNF_ID));
healRequest.setCause(getName());
healRequest.setAdditionalParams(additionalParams);
VfcRequest request = new VfcRequest();
request.setHealRequest(healRequest);
request.setNsInstanceId(serviceInstance);
- request.setRequestId(context.getEvent().getRequestId());
+ request.setRequestId(params.getRequestId());
return request;
}
diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
index ed072f761..46666456a 100644
--- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
+++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
@@ -20,10 +20,12 @@
package org.onap.policy.controlloop.actor.vfc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.AfterClass;
@@ -32,6 +34,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams;
import org.onap.policy.controlloop.policy.PolicyResult;
@@ -89,6 +92,18 @@ public class RestartTest extends BasicVfcOperation {
}
@Test
+ public void testGetPropertyNames() {
+ // @formatter:off
+ assertThat(restartOper.getPropertyNames()).isEqualTo(
+ List.of(
+ OperationProperties.ENRICHMENT_SERVICE_INSTANCE_ID,
+ OperationProperties.ENRICHMENT_VSERVER_ID,
+ OperationProperties.ENRICHMENT_VSERVER_NAME,
+ OperationProperties.ENRICHMENT_GENERIC_VNF_ID));
+ // @formatter:on
+ }
+
+ @Test
public void testMakeRequest() {
Pair<String, VfcRequest> resultPair = restartOper.makeRequest();
assertNotNull(resultPair.getLeft());
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java
index 39977fd41..dfa086595 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actorserviceprovider;
+import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
@@ -43,6 +44,21 @@ public interface Operation {
String getName();
/**
+ * Gets the names of the properties required by the operation.
+ *
+ * @return the names of the properties required by the operation
+ */
+ List<String> getPropertyNames();
+
+ /**
+ * Sets a property.
+ *
+ * @param name property name
+ * @param value new value
+ */
+ public void setProperty(String name, Object value);
+
+ /**
* Called by enforcement PDP engine to start the operation. As part of the operation,
* it invokes the "start" and "complete" call-backs found within the parameters.
*
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java
new file mode 100644
index 000000000..42846460d
--- /dev/null
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.controlloop.actorserviceprovider;
+
+/**
+ * Names of properties needed by the Actors defined within this repo. Note: this is not
+ * exhaustive, as additional property names may be returned by company-defined Actors.
+ */
+public class OperationProperties {
+ public static final String AAI_MODEL_CLOUD_REGION = "AAI/modelInvariantId/cloudRegion";
+ public static final String AAI_MODEL_INVARIANT_GENERIC_VNF = "AAI/modelInvariantId/genericVnf";
+ public static final String AAI_MODEL_SERVICE = "AAI/modelInvariantId/service";
+ public static final String AAI_MODEL_TENANT = "AAI/modelInvariantId/tenant";
+ public static final String AAI_MODEL_VNF = "AAI/modelInvariantId/vnf";
+ public static final String AAI_RESOURCE_SERVICE_INSTANCE = "AAI/resourceId/serviceInstanceId";
+ public static final String AAI_RESOURCE_VNF = "AAI/resourceId/modelInvariantId/vnf";
+ public static final String AAI_PNF = "AAI/pnf";
+ public static final String AAI_VSERVER_LINK = "AAI/vserver/link";
+
+ /*
+ * These are typically extracted from the event or from the event's enrichment data.
+ */
+ public static final String ENRICHMENT_BANDWIDTH = "enrichment/bandwidth";
+ public static final String ENRICHMENT_BANDWIDTH_CHANGE_TIME = "enrichment/bandwidth/changeTime";
+ public static final String ENRICHMENT_GENERIC_VNF_ID = "enrichment/genericVnf/id";
+ public static final String ENRICHMENT_NETWORK_ID = "enrichment/network/id";
+ public static final String ENRICHMENT_SERVICE_ID = "enrichment/service/id";
+ public static final String ENRICHMENT_SERVICE_INSTANCE_ID = "enrichment/serviceInstance/id";
+ public static final String ENRICHMENT_VNF_ID = "enrichment/vnf/id";
+ public static final String ENRICHMENT_VSERVER_ID = "enrichment/vserver/id";
+ public static final String ENRICHMENT_VSERVER_NAME = "enrichment/vserver/name";
+
+ public static final String EVENT_ADDITIONAL_PARAMS = "event/additionalParams";
+ public static final String EVENT_PAYLOAD = "event/payload";
+
+ /*
+ * These are data computed and/or tracked by the invoker.
+ */
+ public static final String DATA_VF_COUNT = "data/vfCount";
+
+
+ private OperationProperties() {
+ super();
+ }
+}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
index 13231e6ad..a3f3a6905 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
@@ -76,10 +76,11 @@ public abstract class BidirectionalTopicOperation<Q, S> extends OperationPartial
* @param params operation parameters
* @param config configuration for this operation
* @param clazz response class
+ * @param propertyNames names of properties required by this operation
*/
public BidirectionalTopicOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config,
- Class<S> clazz) {
- super(params, config);
+ Class<S> clazz, List<String> propertyNames) {
+ super(params, config, propertyNames);
this.config = config;
this.responseClass = clazz;
this.forwarder = config.getForwarder();
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
index 4800b3a4b..09c876d41 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
@@ -21,6 +21,7 @@
package org.onap.policy.controlloop.actorserviceprovider.impl;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
@@ -90,9 +91,11 @@ public abstract class HttpOperation<T> extends OperationPartial {
* @param params operation parameters
* @param config configuration for this operation
* @param clazz response class
+ * @param propertyNames names of properties required by this operation
*/
- public HttpOperation(ControlLoopOperationParams params, HttpConfig config, Class<T> clazz) {
- super(params, config);
+ public HttpOperation(ControlLoopOperationParams params, HttpConfig config, Class<T> clazz,
+ List<String> propertyNames) {
+ super(params, config, propertyNames);
this.config = config;
this.responseClass = clazz;
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
index b28021607..060f7a64b 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
@@ -23,6 +23,7 @@ package org.onap.policy.controlloop.actorserviceprovider.impl;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
@@ -103,17 +104,27 @@ public abstract class OperationPartial implements Operation {
@Setter(AccessLevel.PROTECTED)
private String subRequestId;
+ @Getter
+ private final List<String> propertyNames;
+
+ /**
+ * Values for the properties identified by {@link #getPropertyNames()}.
+ */
+ private final Map<String, Object> properties = new HashMap<>();
+
/**
* Constructs the object.
*
* @param params operation parameters
* @param config configuration for this operation
+ * @param propertyNames names of properties required by this operation
*/
- public OperationPartial(ControlLoopOperationParams params, OperatorConfig config) {
+ public OperationPartial(ControlLoopOperationParams params, OperatorConfig config, List<String> propertyNames) {
this.params = params;
this.config = config;
this.fullName = params.getActor() + "." + params.getOperation();
+ this.propertyNames = propertyNames;
}
public Executor getBlockingExecutor() {
@@ -128,6 +139,27 @@ public abstract class OperationPartial implements Operation {
return params.getOperation();
}
+ /**
+ * Sets a property.
+ *
+ * @param name property name
+ * @param value new value
+ */
+ public void setProperty(String name, Object value) {
+ properties.put(name, value);
+ }
+
+ /**
+ * Gets a property's value.
+ *
+ * @param name name of the property of interest
+ * @return the property's value, or {@code null} if it has no value
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T getProperty(String name) {
+ return (T) properties.get(name);
+ }
+
@Override
public CompletableFuture<OperationOutcome> start() {
// allocate a controller for the entire operation
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
index 7fc15c97b..f5dd49877 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java
@@ -34,6 +34,7 @@ import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.BeanValidator;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.controlloop.actorserviceprovider.ActorService;
+import org.onap.policy.controlloop.actorserviceprovider.Operation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.Util;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
@@ -89,6 +90,12 @@ public class ControlLoopOperationParams {
private Map<String, Object> payload;
/**
+ * {@code True} if the preprocessing steps have already been executed, {@code false}
+ * otherwise.
+ */
+ private boolean preprocessed;
+
+ /**
* Number of retries allowed, or {@code null} if no retries.
*/
private Integer retry;
@@ -137,6 +144,16 @@ public class ControlLoopOperationParams {
* @throws IllegalArgumentException if the parameters are invalid
*/
public CompletableFuture<OperationOutcome> start() {
+ return build().start();
+ }
+
+ /**
+ * Builds the specified operation.
+ *
+ * @return a new operation
+ * @throws IllegalArgumentException if the parameters are invalid
+ */
+ public Operation build() {
BeanValidationResult result = validate();
if (!result.isValid()) {
logger.warn("parameter error in operation {}.{} for {}:\n{}", getActor(), getOperation(), getRequestId(),
@@ -148,8 +165,7 @@ public class ControlLoopOperationParams {
return actorService
.getActor(getActor())
.getOperator(getOperation())
- .buildOperation(this)
- .start();
+ .buildOperation(this);
// @formatter:on
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java
index 3854fb29a..110f84ad8 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actorserviceprovider.pipeline;
+import java.util.Collections;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -38,7 +39,7 @@ public class PipelineUtil extends OperationPartial {
* @param params utility parameters
*/
public PipelineUtil(ControlLoopOperationParams params) {
- super(params, new OperatorConfig(ForkJoinPool.commonPool()));
+ super(params, new OperatorConfig(ForkJoinPool.commonPool()), Collections.emptyList());
}
@Override
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
index b62eae8a6..e28ddeb09 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
@@ -35,6 +35,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
@@ -363,7 +364,7 @@ public class BidirectionalTopicOperationTest {
private class MyStringOperation extends BidirectionalTopicOperation<String, String> {
public MyStringOperation() {
- super(BidirectionalTopicOperationTest.this.params, config, String.class);
+ super(BidirectionalTopicOperationTest.this.params, config, String.class, Collections.emptyList());
}
@Override
@@ -385,7 +386,8 @@ public class BidirectionalTopicOperationTest {
private class MyScoOperation extends BidirectionalTopicOperation<MyRequest, StandardCoderObject> {
public MyScoOperation() {
- super(BidirectionalTopicOperationTest.this.params, config, StandardCoderObject.class);
+ super(BidirectionalTopicOperationTest.this.params, config, StandardCoderObject.class,
+ Collections.emptyList());
}
@Override
@@ -407,7 +409,7 @@ public class BidirectionalTopicOperationTest {
private class MyOperation extends BidirectionalTopicOperation<MyRequest, MyResponse> {
public MyOperation() {
- super(BidirectionalTopicOperationTest.this.params, config, MyResponse.class);
+ super(BidirectionalTopicOperationTest.this.params, config, MyResponse.class, Collections.emptyList());
}
@Override
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
index 1b3485d5d..33e530334 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
@@ -502,7 +502,7 @@ public class HttpOperationTest {
private class MyGetOperation<T> extends HttpOperation<T> {
public MyGetOperation(Class<T> responseClass) {
- super(HttpOperationTest.this.params, HttpOperationTest.this.config, responseClass);
+ super(HttpOperationTest.this.params, HttpOperationTest.this.config, responseClass, Collections.emptyList());
}
@Override
@@ -523,7 +523,8 @@ public class HttpOperationTest {
private class MyPostOperation extends HttpOperation<MyResponse> {
public MyPostOperation() {
- super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class);
+ super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class,
+ Collections.emptyList());
}
@Override
@@ -550,7 +551,8 @@ public class HttpOperationTest {
private class MyPutOperation extends HttpOperation<MyResponse> {
public MyPutOperation() {
- super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class);
+ super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class,
+ Collections.emptyList());
}
@Override
@@ -577,7 +579,7 @@ public class HttpOperationTest {
private class MyDeleteOperation extends HttpOperation<String> {
public MyDeleteOperation() {
- super(HttpOperationTest.this.params, HttpOperationTest.this.config, String.class);
+ super(HttpOperationTest.this.params, HttpOperationTest.this.config, String.class, Collections.emptyList());
}
@Override
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java
index f85ef30b6..5ae804aea 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.when;
+import java.util.Collections;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import org.junit.Before;
@@ -157,7 +158,7 @@ public class HttpOperatorTest {
private class MyOperation extends HttpOperation<String> {
public MyOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, String.class);
+ super(params, config, String.class, Collections.emptyList());
}
@Override
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java
index ed5ba9b56..780964629 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java
@@ -31,6 +31,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import java.util.Collections;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
@@ -196,7 +197,7 @@ public class HttpPollingOperationTest {
@Test
public void testDetmStatus() {
// make an operation that does NOT override detmStatus()
- oper = new HttpOperation<String>(params, config, String.class) {};
+ oper = new HttpOperation<String>(params, config, String.class, Collections.emptyList()) {};
assertThatThrownBy(() -> oper.detmStatus(rawResponse, response))
.isInstanceOf(UnsupportedOperationException.class);
@@ -230,7 +231,7 @@ public class HttpPollingOperationTest {
private static class MyOper extends HttpOperation<String> {
public MyOper(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, String.class);
+ super(params, config, String.class, Collections.emptyList());
setUsePolling();
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java
index 2a22b4b86..413667b20 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
+import java.util.Collections;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -111,7 +112,7 @@ public class HttpPollingOperatorTest {
private static class MyOperation extends HttpOperation<String> {
public MyOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, String.class);
+ super(params, config, String.class, Collections.emptyList());
}
}
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
index e2ed2d98f..9bbc528ec 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
@@ -36,6 +36,7 @@ import ch.qos.logback.classic.Logger;
import java.time.Instant;
import java.util.ArrayDeque;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
@@ -106,6 +107,8 @@ public class OperationPartialTest {
private static final Logger logger = (Logger) LoggerFactory.getLogger(OperationPartial.class);
private static final ExtractAppender appender = new ExtractAppender();
+ private static final List<String> PROP_NAMES = List.of("hello", "world");
+
@Mock
private ActorService service;
@Mock
@@ -217,6 +220,22 @@ public class OperationPartialTest {
}
@Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEqualTo(PROP_NAMES);
+ }
+
+ @Test
+ public void testGetProperty_testSetProperty() {
+ oper.setProperty("propertyA", "valueA");
+ oper.setProperty("propertyB", "valueB");
+ oper.setProperty("propertyC", 20);
+
+ assertEquals("valueA", oper.getProperty("propertyA"));
+ assertEquals("valueB", oper.getProperty("propertyB"));
+ assertEquals(Integer.valueOf(20), oper.getProperty("propertyC"));
+ }
+
+ @Test
public void testStart() {
verifyRun("testStart", 1, 1, PolicyResult.SUCCESS);
}
@@ -406,7 +425,7 @@ public class OperationPartialTest {
/*
* Use an operation that doesn't override doOperation().
*/
- OperationPartial oper2 = new OperationPartial(params, config) {};
+ OperationPartial oper2 = new OperationPartial(params, config, Collections.emptyList()) {};
oper2.start();
assertTrue(executor.runAll(MAX_REQUESTS));
@@ -1118,7 +1137,7 @@ public class OperationPartialTest {
@Test
public void testGetRetryWait() {
// need an operator that doesn't override the retry time
- OperationPartial oper2 = new OperationPartial(params, config) {};
+ OperationPartial oper2 = new OperationPartial(params, config, Collections.emptyList()) {};
assertEquals(OperationPartial.DEFAULT_RETRY_WAIT_MS, oper2.getRetryWaitMs());
}
@@ -1290,7 +1309,7 @@ public class OperationPartialTest {
public MyOper() {
- super(OperationPartialTest.this.params, config);
+ super(OperationPartialTest.this.params, config, PROP_NAMES);
}
@Override
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java
index e4c83049b..98ca6736d 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java
@@ -126,7 +126,7 @@ public class ControlLoopOperationParamsTest {
params = ControlLoopOperationParams.builder().actorService(actorService).completeCallback(completer)
.context(context).executor(executor).actor(ACTOR).operation(OPERATION).payload(payload)
.retry(RETRY).target(TARGET).targetEntity(TARGET_ENTITY).timeoutSec(TIMEOUT)
- .startCallback(starter).build();
+ .startCallback(starter).preprocessed(true).build();
outcome = params.makeOutcome();
}
@@ -139,6 +139,13 @@ public class ControlLoopOperationParamsTest {
}
@Test
+ public void testBuild() {
+ assertSame(operation, params.build());
+
+ assertThatIllegalArgumentException().isThrownBy(() -> params.toBuilder().context(null).build().build());
+ }
+
+ @Test
public void testGetRequestId() {
assertSame(REQ_ID, params.getRequestId());
@@ -292,6 +299,14 @@ public class ControlLoopOperationParamsTest {
}
@Test
+ public void test() {
+ assertTrue(params.isPreprocessed());
+
+ // should be false when unspecified
+ assertFalse(ControlLoopOperationParams.builder().build().isPreprocessed());
+ }
+
+ @Test
public void testGetRetry() {
assertSame(RETRY, params.getRetry());