summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/main
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-30 13:43:10 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-01-31 10:20:02 +0000
commit7f762dfa19f673241f8ea1b2ff3d56d2d58bdcdb (patch)
tree591b04b568efed20c76f7d67973163d075d27162 /runtime-acm/src/main
parent934f7bd443225a6945b0542fa5cb7c043deac426 (diff)
Refactor ACM Update message to ACM Deploy message in ACM
Refactor ACM Update message to ACM Deploy message in ACM and add AcElementDeploy in Deploy message. AutomationCompositionElement will be removed from the message after POLICY-4506 and POLICY-4507. Issue-ID: POLICY-4543 Change-Id: I8444e15b3b4cb1209ffd083fb965e0707fbd9625 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/main')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java23
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java12
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java (renamed from runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java)44
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java12
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java14
5 files changed, 53 insertions, 52 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
index 2542bdb15..374df0135 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
@@ -27,15 +27,15 @@ import java.util.Set;
import java.util.UUID;
import javax.ws.rs.core.Response;
import lombok.AllArgsConstructor;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
@@ -66,7 +66,7 @@ public class SupervisionHandler {
private final AcDefinitionProvider acDefinitionProvider;
// Publishers for participant communication
- private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher;
+ private final AutomationCompositionDeployPublisher automationCompositionDeployPublisher;
private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher;
/**
@@ -76,9 +76,10 @@ public class SupervisionHandler {
*/
@MessageIntercept
@Timed(
- value = "listener.automation_composition_update_ack",
- description = "AUTOMATION_COMPOSITION_UPDATE_ACK messages received")
- public void handleAutomationCompositionUpdateAckMessage(AutomationCompositionAck automationCompositionAckMessage) {
+ value = "listener.automation_composition_deploy_ack",
+ description = "AUTOMATION_COMPOSITION_DEPLOY_ACK messages received")
+ public void handleAutomationCompositionUpdateAckMessage(
+ AutomationCompositionDeployAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition Update Ack message received {}", automationCompositionAckMessage);
setAcElementStateInDb(automationCompositionAckMessage);
}
@@ -128,12 +129,12 @@ public class SupervisionHandler {
value = "listener.automation_composition_statechange_ack",
description = "AUTOMATION_COMPOSITION_STATECHANGE_ACK messages received")
public void handleAutomationCompositionStateChangeAckMessage(
- AutomationCompositionAck automationCompositionAckMessage) {
+ AutomationCompositionDeployAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition StateChange Ack message received {}", automationCompositionAckMessage);
setAcElementStateInDb(automationCompositionAckMessage);
}
- private void setAcElementStateInDb(AutomationCompositionAck automationCompositionAckMessage) {
+ private void setAcElementStateInDb(AutomationCompositionDeployAck automationCompositionAckMessage) {
if (automationCompositionAckMessage.getAutomationCompositionResultMap() != null) {
var automationComposition = automationCompositionProvider
.findAutomationComposition(automationCompositionAckMessage.getAutomationCompositionId());
@@ -152,7 +153,7 @@ public class SupervisionHandler {
}
private boolean updateState(AutomationComposition automationComposition,
- Set<Map.Entry<UUID, AutomationCompositionElementAck>> automationCompositionResultSet) {
+ Set<Map.Entry<UUID, AcElementDeployAck>> automationCompositionResultSet) {
var updated = false;
for (var acElementAck : automationCompositionResultSet) {
var element = automationComposition.getElements().get(acElementAck.getKey());
@@ -256,7 +257,7 @@ public class SupervisionHandler {
break;
case UNINITIALISED:
automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
- automationCompositionUpdatePublisher.send(automationComposition);
+ automationCompositionDeployPublisher.send(automationComposition);
break;
case UNINITIALISED2PASSIVE:
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
index 0e5aab5e3..68ec44dc0 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
@@ -26,8 +26,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.Participant;
@@ -56,7 +56,7 @@ public class SupervisionScanner {
private final AutomationCompositionProvider automationCompositionProvider;
private final AcDefinitionProvider acDefinitionProvider;
private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher;
- private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher;
+ private final AutomationCompositionDeployPublisher automationCompositionDeployPublisher;
private final ParticipantProvider participantProvider;
/**
@@ -65,20 +65,20 @@ public class SupervisionScanner {
* @param automationCompositionProvider the provider to use to read automation compositions from the database
* @param acDefinitionProvider the Policy Models Provider
* @param automationCompositionStateChangePublisher the AutomationComposition StateChange Publisher
- * @param automationCompositionUpdatePublisher the AutomationCompositionUpdate Publisher
+ * @param automationCompositionDeployPublisher the AutomationCompositionUpdate Publisher
* @param participantProvider the Participant Provider
* @param acRuntimeParameterGroup the parameters for the automation composition runtime
*/
public SupervisionScanner(final AutomationCompositionProvider automationCompositionProvider,
AcDefinitionProvider acDefinitionProvider,
final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
- AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
+ AutomationCompositionDeployPublisher automationCompositionDeployPublisher,
ParticipantProvider participantProvider,
final AcRuntimeParameterGroup acRuntimeParameterGroup) {
this.automationCompositionProvider = automationCompositionProvider;
this.acDefinitionProvider = acDefinitionProvider;
this.automationCompositionStateChangePublisher = automationCompositionStateChangePublisher;
- this.automationCompositionUpdatePublisher = automationCompositionUpdatePublisher;
+ this.automationCompositionDeployPublisher = automationCompositionDeployPublisher;
this.participantProvider = participantProvider;
automationCompositionCounter.setMaxRetryCount(
@@ -229,7 +229,7 @@ public class SupervisionScanner {
private void sendAutomationCompositionMsg(AutomationComposition automationComposition, int startPhase) {
if (AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())) {
LOGGER.debug("retry message AutomationCompositionUpdate");
- automationCompositionUpdatePublisher.send(automationComposition, startPhase);
+ automationCompositionDeployPublisher.send(automationComposition, startPhase);
} else {
LOGGER.debug("retry message AutomationCompositionStateChange");
automationCompositionStateChangePublisher.send(automationComposition, startPhase);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
index 57556e088..4a0abc180 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
@@ -29,8 +29,8 @@ import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.slf4j.Logger;
@@ -38,52 +38,52 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
- * This class is used to send AutomationCompositionUpdate messages to participants on DMaaP.
+ * This class is used to send AutomationCompositionDeploy messages to participants on DMaaP.
*/
@Component
@AllArgsConstructor
-public class AutomationCompositionUpdatePublisher extends AbstractParticipantPublisher<AutomationCompositionUpdate> {
+public class AutomationCompositionDeployPublisher extends AbstractParticipantPublisher<AutomationCompositionDeploy> {
- private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdatePublisher.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionDeployPublisher.class);
private final AcDefinitionProvider acDefinitionProvider;
/**
- * Send AutomationCompositionUpdate to Participant.
+ * Send AutomationCompositionDeploy to Participant.
*
* @param automationComposition the AutomationComposition
*/
- @Timed(value = "publisher.automation_composition_update",
- description = "AUTOMATION_COMPOSITION_UPDATE messages published")
+ @Timed(value = "publisher.automation_composition_deploy",
+ description = "AUTOMATION_COMPOSITION_DEPLOY messages published")
public void send(AutomationComposition automationComposition) {
send(automationComposition, 0);
}
/**
- * Send AutomationCompositionUpdate to Participant.
+ * Send AutomationCompositionDeploy to Participant.
*
* @param automationComposition the AutomationComposition
* @param startPhase the Start Phase
*/
- @Timed(value = "publisher.automation_composition_update",
- description = "AUTOMATION_COMPOSITION_UPDATE messages published")
+ @Timed(value = "publisher.automation_composition_deploy",
+ description = "AUTOMATION_COMPOSITION_DEPLOY messages published")
public void send(AutomationComposition automationComposition, int startPhase) {
- var automationCompositionUpdateMsg = new AutomationCompositionUpdate();
- automationCompositionUpdateMsg.setCompositionId(automationComposition.getCompositionId());
- automationCompositionUpdateMsg.setStartPhase(startPhase);
- automationCompositionUpdateMsg.setAutomationCompositionId(automationComposition.getInstanceId());
- automationCompositionUpdateMsg.setMessageId(UUID.randomUUID());
- automationCompositionUpdateMsg.setTimestamp(Instant.now());
+ var acDeployMsg = new AutomationCompositionDeploy();
+ acDeployMsg.setCompositionId(automationComposition.getCompositionId());
+ acDeployMsg.setStartPhase(startPhase);
+ acDeployMsg.setAutomationCompositionId(automationComposition.getInstanceId());
+ acDeployMsg.setMessageId(UUID.randomUUID());
+ acDeployMsg.setTimestamp(Instant.now());
var toscaServiceTemplate =
acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId()).getServiceTemplate();
- List<ParticipantUpdates> participantUpdates = new ArrayList<>();
+ List<ParticipantDeploy> participantDeploys = new ArrayList<>();
for (var element : automationComposition.getElements().values()) {
AcmUtils.setAcPolicyInfo(element, toscaServiceTemplate);
- AcmUtils.prepareParticipantUpdate(element, participantUpdates);
+ AcmUtils.prepareParticipantUpdate(element, participantDeploys);
}
- automationCompositionUpdateMsg.setParticipantUpdatesList(participantUpdates);
+ acDeployMsg.setParticipantUpdatesList(participantDeploys);
- LOGGER.debug("AutomationCompositionUpdate message sent {}", automationCompositionUpdateMsg);
- super.send(automationCompositionUpdateMsg);
+ LOGGER.debug("AutomationCompositionDeploy message sent {}", acDeployMsg);
+ super.send(acDeployMsg);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
index dd07be680..ed1662a95 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
@@ -23,7 +23,7 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm;
import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
@@ -36,8 +36,8 @@ import org.springframework.stereotype.Component;
* Listener for AutomationCompositionStateChangeAck messages sent by participants.
*/
@Component
-public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionAck>
- implements Listener<AutomationCompositionAck> {
+public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionDeployAck>
+ implements Listener<AutomationCompositionDeployAck> {
private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionStateChangeAckListener.class);
private final SupervisionHandler supervisionHandler;
@@ -46,20 +46,20 @@ public class AutomationCompositionStateChangeAckListener extends ScoListener<Aut
* Constructs the object.
*/
public AutomationCompositionStateChangeAckListener(SupervisionHandler supervisionHandler) {
- super(AutomationCompositionAck.class);
+ super(AutomationCompositionDeployAck.class);
this.supervisionHandler = supervisionHandler;
}
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
- final AutomationCompositionAck automationCompositionStateChangeAckMessage) {
+ final AutomationCompositionDeployAck automationCompositionStateChangeAckMessage) {
LOGGER.debug("AutomationCompositionStateChangeAck received from participant - {}",
automationCompositionStateChangeAckMessage);
supervisionHandler.handleAutomationCompositionStateChangeAckMessage(automationCompositionStateChangeAckMessage);
}
@Override
- public ScoListener<AutomationCompositionAck> getScoListener() {
+ public ScoListener<AutomationCompositionDeployAck> getScoListener() {
return this;
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
index 7a1d5294c..64d1fbef1 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
@@ -23,7 +23,7 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm;
import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
@@ -36,8 +36,8 @@ import org.springframework.stereotype.Component;
* Listener for AutomationCompositionUpdateAck messages sent by participants.
*/
@Component
-public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionAck>
- implements Listener<AutomationCompositionAck> {
+public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionDeployAck>
+ implements Listener<AutomationCompositionDeployAck> {
private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdateAckListener.class);
private final SupervisionHandler supervisionHandler;
@@ -46,25 +46,25 @@ public class AutomationCompositionUpdateAckListener extends ScoListener<Automati
* Constructs the object.
*/
public AutomationCompositionUpdateAckListener(SupervisionHandler supervisionHandler) {
- super(AutomationCompositionAck.class);
+ super(AutomationCompositionDeployAck.class);
this.supervisionHandler = supervisionHandler;
}
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
- final AutomationCompositionAck automationCompositionUpdateAckMessage) {
+ final AutomationCompositionDeployAck automationCompositionUpdateAckMessage) {
LOGGER.debug("AutomationCompositionUpdateAck message received from participant - {}",
automationCompositionUpdateAckMessage);
supervisionHandler.handleAutomationCompositionUpdateAckMessage(automationCompositionUpdateAckMessage);
}
@Override
- public ScoListener<AutomationCompositionAck> getScoListener() {
+ public ScoListener<AutomationCompositionDeployAck> getScoListener() {
return this;
}
@Override
public String getType() {
- return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK.name();
}
}