summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-05-26 15:48:51 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-26 15:48:51 +0000
commit584b6dde58b4ace70df7f9b976340a6f3775a2f1 (patch)
tree0eedc9a5f1ef0830fa1c4c3da093a2fc8094b6eb /controlloop/common/eventmanager/src/main
parent84ce39ffa3378a1cf174a780df5a378cd23f13d9 (diff)
parent18486d18e1a684cd4df27b335f565c1d985d4f06 (diff)
Merge "Generate SDNR notification even on timeout"
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java33
1 files changed, 32 insertions, 1 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 9ef892e14..3f7aca6e0 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
@@ -42,6 +42,7 @@ import org.onap.policy.aai.AaiConstants;
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.ControlLoopResponse;
+import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
@@ -514,7 +515,7 @@ public class ControlLoopOperationManager2 implements Serializable {
*/
state = (outcome.getResult() == PolicyResult.SUCCESS ? State.OPERATION_SUCCESS
: State.OPERATION_FAILURE);
- controlLoopResponse = outcome.getControlLoopResponse();
+ controlLoopResponse = makeControlLoopResponse(outcome.getControlLoopResponse());
if (!operationHistory.isEmpty() && operationHistory.peekLast().getClOperation().getEnd() == null) {
operationHistory.removeLast();
}
@@ -530,6 +531,36 @@ public class ControlLoopOperationManager2 implements Serializable {
}
/**
+ * Makes a control loop response.
+ *
+ * @param source original control loop response or {@code null}
+ * @return a new control loop response, or {@code null} none is required
+ */
+ protected ControlLoopResponse makeControlLoopResponse(ControlLoopResponse source) {
+ if (source != null) {
+ return source;
+ }
+
+ // only generate response for certain actors.
+ if (!actor.equals("SDNR")) {
+ return null;
+ }
+
+ VirtualControlLoopEvent event = eventContext.getEvent();
+
+ ControlLoopResponse clRsp = new ControlLoopResponse();
+ clRsp.setFrom(actor);
+ clRsp.setTarget("DCAE");
+ clRsp.setClosedLoopControlName(event.getClosedLoopControlName());
+ clRsp.setPolicyName(event.getPolicyName());
+ clRsp.setPolicyVersion(event.getPolicyVersion());
+ clRsp.setRequestId(event.getRequestId());
+ clRsp.setVersion(event.getVersion());
+
+ return clRsp;
+ }
+
+ /**
* Get the operation, as a message.
*
* @return the operation, as a message