summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.cds/src/main
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 /models-interactions/model-actors/actor.cds/src/main
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>
Diffstat (limited to 'models-interactions/model-actors/actor.cds/src/main')
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/GrpcOperation.java26
1 files changed, 23 insertions, 3 deletions
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 =