summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-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