diff options
author | Rashmi Pujar <rashmi.pujar@bell.ca> | 2019-10-29 16:13:05 -0400 |
---|---|---|
committer | Rashmi Pujar <rashmi.pujar@bell.ca> | 2019-11-04 10:11:21 -0500 |
commit | 73e3ea2f9183fc7ed6ba8c0f221e41a804fbe2c7 (patch) | |
tree | e1033b47c0c1d091bd90d215c44727a99d9dc341 /models-interactions/model-actors/actor.cds | |
parent | 18555714bf9d3204be552c8664f008ec31115479 (diff) |
PNF support changes in policy/models
AAI Enrichment method for PNF target-type and unit tests.
Addition of a hashmap field to ControlLoopEvent class to hold event specific parameters.
Update CDS actor to include additional event parameters
Issue-ID: POLICY-1187
Signed-off-by: Rashmi Pujar <rashmi.pujar@bell.ca>
Change-Id: Ie0ceb320943531de6e6bc8675844b29a358dfb7e
Diffstat (limited to 'models-interactions/model-actors/actor.cds')
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(); |