diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-07-04 09:26:41 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2023-07-13 13:20:31 +0000 |
commit | ef0a60deb046c5bf5ed1a6209493dfde6a6457a9 (patch) | |
tree | 3e92ffecd8579cfb0ddabef80dee5586c695eda1 /participant/participant-impl/participant-impl-policy/src/main | |
parent | 51ef04415186a0de3e50339b7fca04fb5ef079c9 (diff) |
Add restart support inside participants
Issue-ID: POLICY-4747
Change-Id: I09ca3e373f8271fbfe612c031920058b744cf413
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-policy/src/main')
-rw-r--r-- | participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java index 29622149a..6b94a79ad 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java @@ -40,6 +40,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDef import org.onap.policy.clamp.models.acm.concepts.DeployState; import org.onap.policy.clamp.models.acm.concepts.LockState; import org.onap.policy.clamp.models.acm.concepts.StateChangeResult; +import org.onap.policy.clamp.models.acm.utils.AcmUtils; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.pdp.concepts.DeploymentSubGroup; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @@ -244,4 +245,35 @@ public class AutomationCompositionElementHandler implements AutomationCompositio intermediaryApi.updateCompositionState(compositionId, AcTypeState.COMMISSIONED, StateChangeResult.NO_ERROR, "Deprimed"); } + + @Override + public void handleRestartComposition(UUID compositionId, + List<AutomationCompositionElementDefinition> elementDefinitionList, AcTypeState state) + throws PfModelException { + var finalState = AcTypeState.PRIMED.equals(state) || AcTypeState.PRIMING.equals(state) ? AcTypeState.PRIMED + : AcTypeState.COMMISSIONED; + intermediaryApi.updateCompositionState(compositionId, finalState, StateChangeResult.NO_ERROR, "Restarted"); + } + + @Override + public void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element, + Map<String, Object> properties, DeployState deployState, LockState lockState) throws PfModelException { + if (DeployState.DEPLOYING.equals(deployState)) { + deploy(automationCompositionId, element, properties); + return; + } + if (DeployState.UNDEPLOYING.equals(deployState) || DeployState.DEPLOYED.equals(deployState) + || DeployState.UPDATING.equals(deployState)) { + var automationCompositionDefinition = element.getToscaServiceTemplateFragment(); + serviceTemplateMap.put(element.getId(), automationCompositionDefinition); + } + if (DeployState.UNDEPLOYING.equals(deployState)) { + undeploy(automationCompositionId, element.getId()); + return; + } + deployState = AcmUtils.deployCompleted(deployState); + lockState = AcmUtils.lockCompleted(deployState, lockState); + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), deployState, + lockState, StateChangeResult.NO_ERROR, "Restarted"); + } } |