aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-05-27 17:57:51 -0400
committerJim Hahn <jrh3@att.com>2020-05-28 10:31:50 -0400
commitf9bd8844ef8f572cd0db639a9721caa42c17dfe2 (patch)
treeb76001ba365fa04af9225341e427f017d0127e8d /controlloop/common/eventmanager/src/main/java
parentba13401d2878da975b7decd0cf72f40bda1de7bc (diff)
Generate SDNR notification in drools-apps
Modified drools-apps to generate the SDNR notification using the SDNR-response provided by the actor in the operation outcome, instead of using the controlloop-response provided in the operation outcome, as the latter is deprecated. Issue-ID: POLICY-2593 Change-Id: I70ee4a4b11345a4295d720250a63f407f51cb0bd Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main/java')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
index b2a8dd308..2d5ff3974 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
@@ -49,6 +49,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.controlloop.actorserviceprovider.pipeline.PipelineUtil;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.PolicyResult;
+import org.onap.policy.sdnr.PciMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -212,7 +213,7 @@ public class ControlLoopOperationManager2 implements Serializable {
policyResult = outcome.getResult();
clOperation = outcome.toControlLoopOperation();
clOperation.setTarget(policy.getTarget().toString());
- clResponse = outcome.getControlLoopResponse();
+ clResponse = makeControlLoopResponse(outcome);
if (outcome.getEnd() == null) {
clOperation.setOutcome("Started");
@@ -516,7 +517,7 @@ public class ControlLoopOperationManager2 implements Serializable {
*/
state = (outcome.getResult() == PolicyResult.SUCCESS ? State.OPERATION_SUCCESS
: State.OPERATION_FAILURE);
- controlLoopResponse = makeControlLoopResponse(outcome.getControlLoopResponse());
+ controlLoopResponse = makeControlLoopResponse(outcome);
if (!operationHistory.isEmpty() && operationHistory.peekLast().getClOperation().getEnd() == null) {
operationHistory.removeLast();
}
@@ -557,7 +558,7 @@ public class ControlLoopOperationManager2 implements Serializable {
outcome.setStart(operOrig.getClOperation().getStart());
}
- controlLoopResponse = makeControlLoopResponse(outcome.getControlLoopResponse());
+ controlLoopResponse = makeControlLoopResponse(outcome);
storeFailureInDataBase(outcome, result, message);
}
@@ -565,16 +566,13 @@ public class ControlLoopOperationManager2 implements Serializable {
/**
* Makes a control loop response.
*
- * @param source original control loop response or {@code null}
+ * @param outcome operation outcome
* @return a new control loop response, or {@code null} if none is required
*/
- protected ControlLoopResponse makeControlLoopResponse(ControlLoopResponse source) {
- if (source != null) {
- return source;
- }
+ protected ControlLoopResponse makeControlLoopResponse(OperationOutcome outcome) {
// only generate response for certain actors.
- if (!actor.equals("SDNR")) {
+ if (outcome == null || !actor.equals("SDNR")) {
return null;
}
@@ -589,6 +587,11 @@ public class ControlLoopOperationManager2 implements Serializable {
clRsp.setRequestId(event.getRequestId());
clRsp.setVersion(event.getVersion());
+ PciMessage msg = outcome.getResponse();
+ if (msg != null && msg.getBody() != null && msg.getBody().getOutput() != null) {
+ clRsp.setPayload(msg.getBody().getOutput().getPayload());
+ }
+
return clRsp;
}