From 461bbdb67733552e78037bd96ca7efdfd3015e25 Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Thu, 18 May 2023 16:47:10 +0100 Subject: Update AC Element properties on the DEPLOYED state User can update the instance property values on DEPLOYED state. The runtime sends PROPERTY_UPDATE event to the participants and the updated values are stored on the runtime database. Participants can implement the update method to perform the required action. Issue-ID: POLICY-4682 Signed-off-by: zrrmmua Change-Id: Ic35fba669b5ffcf2c75d6deaa8c309d58e4026f0 --- .../clamp/models/acm/concepts/DeployState.java | 3 +- .../dmaap/participant/ParticipantMessageType.java | 13 ++++- .../dmaap/participant/PropertiesUpdate.java | 61 ++++++++++++++++++++++ .../messages/rest/instantiation/DeployOrder.java | 3 +- 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java (limited to 'models') diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java index 94aa07097..9dde703b6 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java @@ -26,5 +26,6 @@ public enum DeployState { UNDEPLOYED, UNDEPLOYING, DELETING, - DELETED + DELETED, + UPDATING } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java index 474bcd36f..e60a13202 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java @@ -100,5 +100,16 @@ public enum ParticipantMessageType { /** * Used by automation composition runtime to request for PARTICIPANT_STATUS message immediately. */ - PARTICIPANT_STATUS_REQ + PARTICIPANT_STATUS_REQ, + + /** + * Used by automation composition runtime to send the element properties update to participant. + */ + PROPERTIES_UPDATE, + + /** + * Used by participant to acknowledge the receipt of PROPERTIES_UPDATE message + * from automation composition runtime. + */ + PROPERTIES_UPDATE_ACK } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java new file mode 100644 index 000000000..43573cc08 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.models.acm.messages.dmaap.participant; + +import java.util.ArrayList; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; +import org.onap.policy.models.base.PfUtils; + + +/** + * Class to represent the PROPERTIES_UPDATE message that the ACM runtime sends to a participant. + * The ACM Runtime sends updated automation composition element property values to Participants. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class PropertiesUpdate extends ParticipantMessage { + + // A list of updates to AC element properties + private List participantUpdatesList = new ArrayList<>(); + + /** + * Constructor for instantiating properties update class with message name. + * + */ + public PropertiesUpdate() { + super(ParticipantMessageType.PROPERTIES_UPDATE); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public PropertiesUpdate(PropertiesUpdate source) { + super(source); + this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantDeploy::new); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java index f4b57f1d1..318b36a19 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java @@ -24,5 +24,6 @@ public enum DeployOrder { NONE, UNDEPLOY, DEPLOY, - DELETE + DELETE, + UPDATE } -- cgit 1.2.3-korg