aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-07-07 10:24:16 +0100
committerRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>2023-07-14 15:52:02 +0000
commit3fdffd62f70bd3a45175e78bd8c757dfdb15b45d (patch)
tree6e0b4ac45cde381d261e980b1984a866e730aa9e
parent11221212331b62aa4c3fec25ad1c6d863d77d989 (diff)
Add restart in Participant developer guidelondon
Issue-ID: POLICY-4764 Change-Id: Ic499889b1de462635a3f9e64be9945ba3b800c5e Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech> (cherry picked from commit 96d0abc946c6d66fc9008e7f08935e6c1dc35b7b)
-rw-r--r--docs/clamp/acm/acm-participant-guide.rst65
1 files changed, 64 insertions, 1 deletions
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<String, Object> inProperties) throws PfModelException;
7. void prime(UUID compositionId, List<AutomationCompositionElementDefinition> elementDefinitionList) throws PfModelException;
8. void deprime(UUID compositionId) throws PfModelException;
+ 9. void handleRestartComposition(UUID compositionId, List<AutomationCompositionElementDefinition> elementDefinitionList, AcTypeState state) throws PfModelException;
+ 10. void handleRestartInstance(UUID automationCompositionId, AcElementDeploy element, Map<String, Object> 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<AutomationCompositionElementDefinition> 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<String, Object> 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");
+ }
+