How startPhase is currently implemented
Example using the Demo. The table below shows the startPhase for each Composition Definition Element
Participant | Composition Definition Element | startPhase |
---|---|---|
Policy | onap.policy.clamp.ac.element.Policy_AutomationCompositionElement | 0 |
K8s | onap.policy.clamp.ac.element.K8S_StarterAutomationCompositionElement | 0 |
K8s | onap.policy.clamp.ac.element.K8S_BridgeAutomationCompositionElement | 0 |
K8s | onap.policy.clamp.ac.element.K8S_SinkAutomationCompositionElement | 0 |
Http | onap.policy.clamp.ac.element.Http_StarterAutomationCompositionElement | 1 |
Http | onap.policy.clamp.ac.element.Http_BridgeAutomationCompositionElement | 1 |
Http | onap.policy.clamp.ac.element.Http_SinkAutomationCompositionElement | 1 |
The diagram below shows the flow of messages:Note:
- startPhase is configured in composition definition element and defines the order of execution of instance elements;
- Any instance element is executed only once;
- All instance elements whit same startPhase are executed at same time in parallel;
- startPhase is used by deploy and unlock; startPhase in reverse order is used by lock, undeploy and delete;
Alternative flow with "stage"
To maintain the backward compatibility, we are introducing a new property: "stage".
Minimal support for stage:
- Still valid the startPhase definition for backward compatibility;
- stage is configured in composition definition element;
- stage is applied only for migrate operation;
- Any instance element could be executed more then one time;
- All instance elements whit same stage are executed at same time in parallel;
Example of composition definition element stage property:
properties: stage: [0,2]
Default value set to 0.
Full support for stage:
- Still valid the startPhase definition for backward compatibility;
- Using startPhase and stage in a composition definition is not valid;
- stage is configured in composition definition element;
- Any composition definition element could have different sptePhase for each operation: for example the order for deploy could different for migrate;
- Any instance element could be executed more then one time;
- All instance elements whit same stage are executed at same time in parallel;
- stage has not reversal order.
Example of composition definition element stage property:
properties: stage: - deploy: [0,1] - migrate: [0,2] - undeploy: [1] - delete: [1]
All not defined operations will be set to 0.
Example of stage
The table below shows the stage for each Composition Definition Element:
Participant | Composition Definition Element | stage |
---|---|---|
SEF | A1 | 0, 2 |
SEF | A2 | 0, 2 |
CNLCM | B | 1 |
At the migrate method will be add a new stage parameter, and it will be created a new abstract class AcElementListenerV3. The abstract class AcElementListenerV1 and AcElementListenerV2 will wrap the new method to maintain the compatibility.
Below the refactored migrate method.
/** * Handle an update on a automation composition element. * * @param compositionElement the information of the Automation Composition Definition Element * @param compositionElementTarget the information of the Automation Composition Definition Element Target * @param instanceElement the information of the Automation Composition Instance Element * @param instanceElementMigrate the information of the Automation Composition Instance Element updated * @param stage the stage to perform * @throws PfModelException from Policy framework */ void migrate(CompositionElementDto compositionElement, CompositionElementDto compositionElementTarget, InstanceElementDto instanceElement, InstanceElementDto instanceElementMigrate, Integer stage) throws PfModelException;
When an instance element has completed a step, not means that the full implementation is completed (DEPLOYED state).
It will add new method "updateAutomationCompositionElementState" as below:
/** * Update the state of a automation composition element. * * @param automationCompositionId the ID of the automation composition to update the state on * @param elementId the ID of the automation composition element to update the state on * @param deployState the Deploy State of the automation composition element * @param lockState the Lock State of the automation composition element * @param stateChangeResult the indicator if error occurs * @param stageCompleted the stage completed * @param message the message */ void updateAutomationCompositionElementState(UUID automationCompositionId, UUID elementId, DeployState deployState, LockState lockState, StateChangeResult stateChangeResult, Integer stageCompleted, String message);
During the execution of the operation how the user is able to see the steps executed by the instance element? Same for monitoring, it needs new filed into Instance Element to store what step is executed.
"709c62b3-8918-41b9-a747-d21eb79c6c23": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", "definition": { "name": "onap.policy.clamp.ac.element.Http_SinkAutomationCompositionElement", "version": "1.2.3" }, "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c91", "deployState": "DEPLOYING", "stage": 1, "lockState": "NONE", "description": "Sink Automation Composition Element for the Demo", "message": "",