summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.cds
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors/actor.cds')
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java5
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequest.java11
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java4
3 files changed, 17 insertions, 3 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java
index 65cc03931..df13ba306 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProvider.java
@@ -130,6 +130,11 @@ public class CdsActorServiceProvider implements Actor {
// E.g. For vFW usecase El-Alto inject service-instance-id, generic-vnf-id as needed by CDS.
request.setAaiProperties(aaiParams);
+ // Inject any additional event parameters that may be present in the onset event
+ if (onset.getAdditionalEventParams() != null) {
+ request.setAdditionalEventParams(onset.getAdditionalEventParams());
+ }
+
Builder struct = Struct.newBuilder();
try {
String requestStr = request.generateCdsPayload();
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequest.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequest.java
index 38ab2bdc7..4193db59f 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequest.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequest.java
@@ -38,16 +38,18 @@ public class CdsActionRequest implements Serializable {
private String resolutionKey;
private Map<String, String> aaiProperties;
private Map<String, String> policyPayload;
+ private Map<String, String> additionalEventParams;
/**
* Generate the CDS gRPC request payload from the action-name (aka operational policy recipe).
* The CDS gRPC request payload generation follows the below pattern:
* {
* "{@link CdsActionRequest#getActionName()}-request": {
- * "resolution-key": "{@link CdsActionRequest#getResolutionKey()} ()}",
+ * "resolution-key": "{@link CdsActionRequest#getResolutionKey()}",
* "{@link CdsActionRequest#getActionName()}-properties": {
- * "{@link CdsActionRequest#getAaiProperties()} ()}",
- * "{@link CdsActionRequest#getPolicyPayload()} ()}"
+ * "{@link CdsActionRequest#getAaiProperties()}",
+ * "{@link CdsActionRequest#getPolicyPayload()}",
+ * "{@link CdsActionRequest#getAdditionalEventParams()}"
* }
* }
* }
@@ -59,6 +61,9 @@ public class CdsActionRequest implements Serializable {
Map<String, String> cdsActionPropsMap = new LinkedHashMap<>();
cdsActionPropsMap.putAll(aaiProperties);
cdsActionPropsMap.putAll(policyPayload);
+ if (additionalEventParams != null) {
+ cdsActionPropsMap.putAll(additionalEventParams);
+ }
// 2. Build the enclosing CDS action request properties object to contain (1) and the resolution-key
Map<String, Object> cdsActionRequestMap = new LinkedHashMap<>();
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java
index 3f28bada4..e34fa33ab 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/request/CdsActionRequestTest.java
@@ -43,6 +43,10 @@ public class CdsActionRequestTest {
ImmutableMap.of("service-instance.service-instance-id", "1234", "generic-vnf.vnf-id", "5678");
req.setAaiProperties(aaiParams);
+ Map<String, String> eventParams =
+ ImmutableMap.of("event-param-1", "1234", "event-param-2", "5678");
+ req.setAdditionalEventParams(eventParams);
+
// Act
String result = req.generateCdsPayload();