From 19a6f09f4fd90ba4ede88165bd302acf907069ca Mon Sep 17 00:00:00 2001 From: Ritu Sood Date: Wed, 27 Sep 2017 03:19:57 -0700 Subject: Add functionality for VFC request retries This allows the control loop to track operation attempts in case of VFC failures. This will allow retries of the operation if required in the YAML file. Issue-ID: POLICY-270 Change-Id: Ieeaf6770a8d03fa4eecc976535301d9236d19972 Signed-off-by: Ritu Sood --- .../controlloop/eventmanager/ControlLoopOperationManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'controlloop') 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 add981c65..e13352ac0 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 @@ -375,11 +375,12 @@ public class ControlLoopOperationManager implements Serializable { } else if (response instanceof VFCResponse) { VFCResponse vfcResponse = (VFCResponse) response; + Integer operationAttempt = this.attempts; if (vfcResponse.responseDescriptor.getStatus().equalsIgnoreCase("finished")) { // // Consider it as success // - this.completeOperation(new Integer(1), " Success", PolicyResult.SUCCESS); + this.completeOperation(operationAttempt, " Success", PolicyResult.SUCCESS); if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) { return null; } @@ -388,10 +389,12 @@ public class ControlLoopOperationManager implements Serializable { // // Consider it as failure // - this.completeOperation(new Integer(1), " Failed", PolicyResult.FAILURE); + this.completeOperation(operationAttempt, " 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; } } -- cgit 1.2.3-korg