aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnc/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.sdnc/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.sdnc/src/main')
-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
3 files changed, 26 insertions, 6 deletions
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);
}
/**