summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnc
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors/actor.sdnc')
-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
6 files changed, 57 insertions, 7 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);
}
/**
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;