From b9007182f9a8fa0dea48fc970e38fb6761bf6c24 Mon Sep 17 00:00:00 2001 From: Vidyashree Rama Date: Thu, 18 Oct 2018 11:45:52 +0530 Subject: Add CCVPN policy CCVPN policy Issue-ID: POLICY-1209 Change-Id: I8adea233f8672c9ff43b4a169b50336d9e43c91d Signed-off-by: Vidyashree Rama --- .../eventmanager/ControlLoopOperationManager.java | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'controlloop/common/eventmanager') diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index 980799171..5abfca47b 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -356,6 +356,11 @@ public class ControlLoopOperationManager implements Serializable { // Cast VFC response and handle it // return onResponse((VFCResponse) response); + } else if (response instanceof SdncResponse) { + // + // Cast SDNC response and handle it + // + return onResponse((SdncResponse) response); } else { return null; } @@ -582,6 +587,36 @@ public class ControlLoopOperationManager implements Serializable { } } + /** + * This method handles operation responses from SDNC. + * + * @param sdncResponse the VFC response + * @return The result of the response handling + */ + private PolicyResult onResponse(SdncResponse sdncResponse) { + if ("200".equals(sdncResponse.getResponseOutput().getResponseCode())) { + // + // Consider it as success + // + this.completeOperation(this.attempts, " Success", PolicyResult.SUCCESS); + if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) { + return null; + } + return PolicyResult.SUCCESS; + } else { + // + // Consider it as failure + // + this.completeOperation(this.attempts, " Failed", PolicyResult.FAILURE); + if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) { + return null; + } + // increment operation attempts for retries + this.attempts += 1; + return PolicyResult.FAILURE; + } + } + /** * Get the operation timeout. * -- cgit 1.2.3-korg