diff options
author | Jim Hahn <jrh3@att.com> | 2020-07-29 13:50:40 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-07-31 14:08:17 -0400 |
commit | acded8235dcbb0b06abaa98297fecef78b4eec41 (patch) | |
tree | 8b400d09875cd2c6f7844fbbe0c4d9e1e1a16230 /models-interactions/model-actors/actor.so/src/main | |
parent | 1da24b28d9df7c8ad5154d7788dab0ab9da589f8 (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>
Diffstat (limited to 'models-interactions/model-actors/actor.so/src/main')
3 files changed, 27 insertions, 4 deletions
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(); |