From 96d0abc946c6d66fc9008e7f08935e6c1dc35b7b Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Fri, 7 Jul 2023 10:24:16 +0100 Subject: Add restart in Participant developer guide Issue-ID: POLICY-4764 Change-Id: Ic499889b1de462635a3f9e64be9945ba3b800c5e Signed-off-by: FrancescoFioraEst --- docs/clamp/acm/acm-participant-guide.rst | 65 +++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) (limited to 'docs/clamp/acm') diff --git a/docs/clamp/acm/acm-participant-guide.rst b/docs/clamp/acm/acm-participant-guide.rst index 4ce979e0..9228ca37 100644 --- a/docs/clamp/acm/acm-participant-guide.rst +++ b/docs/clamp/acm/acm-participant-guide.rst @@ -90,6 +90,8 @@ AutomationCompositionElementListener: 6. void update(UUID automationCompositionId, AcElementDeploy element, Map inProperties) throws PfModelException; 7. void prime(UUID compositionId, List elementDefinitionList) throws PfModelException; 8. void deprime(UUID compositionId) throws PfModelException; + 9. void handleRestartComposition(UUID compositionId, List elementDefinitionList, AcTypeState state) throws PfModelException; + 10. void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element, Map properties, DeployState deployState, LockState lockState) throws PfModelException; These method from the interface are implemented independently as per the user requirement. These methods after handling the appropriate requests should also invoke the intermediary's publisher apis to notify the ACM-runtime with the acknowledgement events. @@ -143,7 +145,11 @@ In/Out Properties outProperties.put("myProperty", myProperty); intermediaryApi.sendAcElementInfo(automationCompositionId, elementId, acElement.getUseState(), acElement.getOperationalState(), outProperties); - +Restart scenario +---------------- + Restart methods handle the scenario when participant shut down and restart. + The method handleRestartComposition will be called for each composition and will be present the 'state' at the time the participant shut down. + The method handleRestartInstance will be called for each instance element and will be present the 'deployState' and the 'lockState' at the time the participant shut down. In ONAP, the following participants are already implemented in java spring boot for various requirements. The maven modules can be referred here: @@ -356,4 +362,61 @@ The following example shows the Handler implementation and how could be the impl } + @Override + public void handleRestartComposition(UUID compositionId, + List elementDefinitionList, AcTypeState state) + throws PfModelException { + + switch (state) { + case PRIMING: + prime(compositionId, elementDefinitionList); + break; + + case DEPRIMING: + // TODO restart process + + deprime(compositionId); + break; + + default: + // TODO restart process + + intermediaryApi.updateCompositionState(compositionId, state, StateChangeResult.NO_ERROR, "Restarted"); + } + } + + @Override + public void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element, + Map properties, DeployState deployState, LockState lockState) throws PfModelException { + + // TODO restart process + + if (DeployState.DEPLOYING.equals(deployState)) { + deploy(automationCompositionId, element, properties); + return; + } + if (DeployState.UNDEPLOYING.equals(deployState)) { + undeploy(automationCompositionId, element.getId()); + return; + } + if (DeployState.UPDATING.equals(deployState)) { + update(automationCompositionId, element, properties); + return; + } + if (DeployState.DELETING.equals(deployState)) { + delete(automationCompositionId, element.getId()); + return; + } + if (LockState.LOCKING.equals(lockState)) { + lock(automationCompositionId, element.getId()); + return; + } + if (LockState.UNLOCKING.equals(lockState)) { + unlock(automationCompositionId, element.getId()); + return; + } + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), + deployState, lockState, StateChangeResult.NO_ERROR, "Restarted"); + } + -- cgit 1.2.3-korg