Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A simple solution from participant side is that it can use "useState" and outProperties" operationalState" to save information related to the deployment process.

"useState", "operationalState" and "outProperties" are is controlled by the participant side, and saved into ACM-r Db by status message (by sendAcElementInfo method).

To support the participant implementation we can add "useState" and "operationalState" into the InstanceElementDto:

Code Block
languagejava
public record InstanceElementDto(UUID instanceId, UUID elementId, ToscaServiceTemplate toscaServiceTemplateFragment,
                                 Map<String, Object> inProperties, Map<String, Object> outProperties, String operationalState, String useState) {
}

The examples below

...

are suggestions.

  • Below a suggestion with operationalStatesimple example:
Code Block
languagejava
    @Override
    public void deploy(CompositionElementDto compositionElement, InstanceElementDto instanceElement) throws PfModelException {

        if ("DEPLOYED".equals(instanceElement.outProperties().operationalStateget("state"))) {
             // deploy process already done
            intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(), instanceElement.elementId(), DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Already Deployed");
            return;
           }
         
        // deployment process
        .......................................
        .......................................
        // end of the deployment process
        
        if (isDeploySuccess()) {
            instanceElement.outProperties().put("state", "DEPLOYED");
            intermediaryApi.sendAcElementInfo(instanceElement.instanceId(), instanceElement.elementId(), ""null, "DEPLOYED"null, instanceElement.outProperties());
 
            intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(), instanceElement.elementId(), DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Deployed");
        } else {
            instanceElement.outProperties().put("state", "UNDEPLOYED");
            intermediaryApi.sendAcElementInfo(instanceElement.instanceId(), instanceElement.elementId(), null, null, instanceElement.outProperties());
 
            intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(), instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.FAILED, "Deploy failed!");
        } 
    }


    @Override
    public void undeploy(CompositionElementDto compositionElement, InstanceElementDto instanceElement) throws PfModelException {

        if ("UNDEPLOYEDDEPLOYED".equals(instanceElement.operationalState(outProperties().get("state"))) {
                 // undeploy process already done

            intermediaryApi.updateAutomationCompositionElementState(instanceId, elementId, DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR, "Already Undeployed");
            return;
        }

        // undeployment process
        .......................................
        .......................................
        // end of the undeployment process        
        
        if (isUndeploySuccess()) {
             instanceElement.outProperties().put("state", "UNDEPLOYED");
            intermediaryApi.sendAcElementInfo(instanceElement.instanceId(), instanceElement.elementId(), ""null, "UNDEPLOYED"null, instanceElement.outProperties());

            intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(), instanceElement.elementId(), DeployState.UNDEPLOYED, null, StateChangeResult.NO_ERROR, "Undeployed");
        } else {
            instanceElement.outProperties().put("state", "DEPLOYED");
            intermediaryApi.sendAcElementInfo(instanceElement.instanceId(), instanceElement.elementId(), null, null, instanceElement.outProperties());

            intermediaryApi.updateAutomationCompositionElementState(instanceElement.instanceId(), instanceElement.elementId(), DeployState.DEPLOYED, null, StateChangeResult.FAILED, "Undeploy failed!");
        }
     }


  • Below other suggestion with operationalState and useState:

...