- Some property values are OK to change at run time, some aren’t.
- Should we allow property values to be changed at run time?
- We need to support this. Property changes at run time.
- Only allowed for properties where restart of ACM elements is not required.
- To be implemented.
The easiest way to support this is to add a flag to properties in Composition definitions that indicate that they are OK to change at runtime. The default should be that we do not allow changes at runtime.
We need to see how we should implement this, we may need a new runtime<--→participant message for this or we could use the current update message.
Changes on Common Properties are only allowed on Automation Composition Definitions in state COMMISSIONED.
Changes on Instance Properties are only allowed on Automation Composition Instances in state UNDEPLOYED.
This work is covered in - POLICY-4415Getting issue details... STATUS
Currently, properties can be updated on AC Instances when they are undeployed.
- The AC definition should flag that indicates whether a property can be updated on a deployed instance or not. The default is that the property cannot be changed when an instance is deployed.
- We need a new message between ACM Runtime and the participant intermediary to handle this and a new Java API message between the Participant Intermediary and the participant implementation
- Multiple properties can be updated at the same time if more than one property has permission to be updated at runtime.
- We should use a new PUSH REST call on the participant instance to allow properties to be changed, it will be a lost of properties and values (YAML/JSON)
Initial Proposal
- "allowChange" flag should be provide by the user in AC definition properties.
The example below shows the new flag in "org.onap.policy.clamp.acm.HttpAutomationCompositionElement" definition
configurationEntities: type: map required: true allowChange: true entry_schema: type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity type_version: 1.0.0 description: The configuration entities the Automation Composition Element is managing and their associated REST requests
- a new message type will be created to send to participants (AC_PROPERTIES_UPDATE) and a new message type to send back (AC_PROPERTIES_UPDATE_ACK)
- participants and intermediary will be update accordingly
- When a client needs to replace an existing Resource entirely, they can use PUT. When they're doing a partial update, they can use HTTP PATCH. (https://www.baeldung.com/http-put-patch-difference-spring)
This patch, will update the original instance saved in db.
The example below shows endpoint and body to change the property configurationEntities of a specific instance:
PATCH /onap/policy/clamp/acm/v2/compositions/{{compositionId}}/instances
compositionId
/instancesname: DemoInstance0 version: 1.0.1 compositionId: {{compositionId}} instanceId: {{instanceId}} elements: 709c62b3-8918-41b9-a747-d21eb79c6c24: id: 709c62b3-8918-41b9-a747-d21eb79c6c24 definition: name: onap.policy.clamp.ac.element.Http_StarterAutomationCompositionElement version: 1.2.3 properties: configurationEntities: - configurationEntityId: name: onap.policy.clamp.ac.starter version: 1.0.0 restSequence: - restRequestId: name: request1 version: 1.0.1 httpMethod: POST path: /onap/policy/clamp/acelement/v2/activate body: '{ "receiverId": { "name": "onap.policy.clamp.ac.startertobridge", "version": "1.0.0" }, "timerMs": 10000, "elementType": "STARTER", "topicParameterGroup": { "server": "message-router:3904", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 10000, "topicCommInfrastructure": "dmaap" } }' expectedResponse: 201
It needs a new TRANSITIONAL STATE (example UPDATING) to show the current instance element state.
When runtime receive the message back the transitional state will return in the original status.
- Questions:
- Can this update, be used as operational action instead of a configuration update? (I think that is not the purpose)
Could the transactional state be the LookState { "lockState": "UPDATING", "deployState":"DEPLOYED" } or { "lockState": "LOCKED", "deployState":"UPDATING" }
- participant do not designed for update will ignore the message
- transitional state where is allowed to update properties (LOCK,UNLOCK?)
- move policy to instance to be updated (in undeploy and deploy if allowed) (could be done later)