From 1d1908528e67d9763482cf9d5921456f19af31e7 Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Mon, 12 Jun 2023 16:24:32 +0100 Subject: Add timeout for ACM operations User can retry the ACM state change order when ACM operations time out. Issue-ID: POLICY-4716 Signed-off-by: zrrmmua Change-Id: Ie840fc13170ef235c6b6f3b26a47b7516f10296c --- .../clamp/models/acm/concepts/StateChangeResult.java | 3 ++- .../persistence/provider/AcInstanceStateResolver.java | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'models/src/main/java') diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/StateChangeResult.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/StateChangeResult.java index de4404fdd..c09b79df5 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/StateChangeResult.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/StateChangeResult.java @@ -22,5 +22,6 @@ package org.onap.policy.clamp.models.acm.concepts; public enum StateChangeResult { NO_ERROR, - FAILED + FAILED, + TIMEOUT } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java index 659169b9f..e2f4fdf9b 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java @@ -50,6 +50,7 @@ public class AcInstanceStateResolver { private static final String NO_ERROR = StateChangeResult.NO_ERROR.name(); private static final String FAILED = StateChangeResult.FAILED.name(); + private static final String TIMEOUT = StateChangeResult.TIMEOUT.name(); // list of results public static final String DEPLOY = DeployOrder.DEPLOY.name(); @@ -87,6 +88,22 @@ public class AcInstanceStateResolver { this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, UNLOCKING, FAILED}, LOCK); this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, UNLOCKING, FAILED}, UNLOCK); + + // timeout + this.graph.put(new String[] {DEPLOY, LOCK_NONE, UNDEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, DEPLOY); + this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, UNDEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, UNDEPLOY); + this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, UPDATING, STATE_LOCKED_NONE, TIMEOUT}, UNDEPLOY); + + this.graph.put(new String[] {DEPLOY, LOCK_NONE, DEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, DEPLOY); + this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, DEPLOYING, STATE_LOCKED_NONE, TIMEOUT}, UNDEPLOY); + + this.graph.put(new String[] {DELETE, LOCK_NONE, DELETING, LOCK_NONE, TIMEOUT}, DELETE); + + this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, LOCKING, TIMEOUT}, UNLOCK); + this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, LOCKING, TIMEOUT}, LOCK); + + this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, UNLOCKING, TIMEOUT}, LOCK); + this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, UNLOCKING, TIMEOUT}, UNLOCK); } /** -- cgit