summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src
diff options
context:
space:
mode:
authorVidyashree Rama <vidyashree.rama@huawei.com>2018-10-18 11:45:52 +0530
committerVidyashree Rama <vidyashree.rama@huawei.com>2018-10-23 18:28:01 +0530
commitb9007182f9a8fa0dea48fc970e38fb6761bf6c24 (patch)
tree8acc33b3aab928e3b7e1d4db7baee7c5ee4135af /controlloop/common/eventmanager/src
parentecffd0e5dfe112bcc69ee420848bbc476571637c (diff)
Add CCVPN policy
CCVPN policy Issue-ID: POLICY-1209 Change-Id: I8adea233f8672c9ff43b4a169b50336d9e43c91d Signed-off-by: Vidyashree Rama <vidyashree.rama@huawei.com>
Diffstat (limited to 'controlloop/common/eventmanager/src')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java35
1 files changed, 35 insertions, 0 deletions
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;
}
@@ -583,6 +588,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.
*
* @return the timeout