summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-04 17:04:37 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-01-06 08:52:36 +0000
commit026cfefbe02cfc87c04f13d4b5ce7085f3ee360b (patch)
tree23566f2de245403b1fd0cc31978bced13eaec3ea /participant/participant-intermediary
parentbce4edfb6a9140a07d12470d977352d7b3a4105c (diff)
Refactor register deregister a Participant and Supervise Participants
Refactor register deregister a Participant and Supervise Participants using ON_LINE/OFF_LINE as Participant Status. Issue-ID: POLICY-4497 Change-Id: If9c5b92131c99132c18340e56334fb9453745526 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java29
1 files changed, 3 insertions, 26 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index b442b9967..6edf1ffd4 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -29,13 +29,11 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import lombok.Getter;
-import lombok.Setter;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
@@ -70,12 +68,6 @@ public class ParticipantHandler {
private final AutomationCompositionHandler automationCompositionHandler;
private final ParticipantMessagePublisher publisher;
- @Setter
- private ParticipantState state = ParticipantState.UNKNOWN;
-
- @Setter
- private ParticipantHealthStatus healthStatus = ParticipantHealthStatus.UNKNOWN;
-
private final Map<UUID, List<AutomationCompositionElementDefinition>> acElementDefsMap = new HashMap<>();
/**
@@ -169,21 +161,9 @@ public class ParticipantHandler {
public void handleParticipantRegisterAck(ParticipantRegisterAck participantRegisterAckMsg) {
LOGGER.debug("ParticipantRegisterAck message received as responseTo {}",
participantRegisterAckMsg.getResponseTo());
- statusToPassive();
publisher.sendParticipantStatus(makeHeartbeat(false));
}
- private void statusToPassive() {
- if (ParticipantHealthStatus.UNKNOWN.equals(this.healthStatus)) {
- this.healthStatus = ParticipantHealthStatus.HEALTHY;
- }
-
- if (ParticipantState.UNKNOWN.equals(this.state) || ParticipantState.TERMINATED.equals(this.state)) {
- this.state = ParticipantState.PASSIVE;
- }
-
- }
-
/**
* Method to send ParticipantDeregister message to automation composition runtime.
*/
@@ -218,7 +198,6 @@ public class ParticipantHandler {
acElementDefsMap.putIfAbsent(participantUpdateMsg.getCompositionId(), new ArrayList<>());
if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
- statusToPassive();
// This message is to commission the automation composition
for (var participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantType().equals(participantType)) {
@@ -230,7 +209,6 @@ public class ParticipantHandler {
} else {
// This message is to decommission the automation composition
acElementDefsMap.get(participantUpdateMsg.getCompositionId()).clear();
- this.state = ParticipantState.TERMINATED;
}
sendParticipantUpdateAck(participantUpdateMsg.getMessageId());
}
@@ -245,7 +223,7 @@ public class ParticipantHandler {
participantUpdateAck.setResult(true);
participantUpdateAck.setParticipantId(participantId);
participantUpdateAck.setParticipantType(participantType);
- participantUpdateAck.setState(state);
+ participantUpdateAck.setState(ParticipantState.ON_LINE);
publisher.sendParticipantUpdateAck(participantUpdateAck);
}
@@ -263,8 +241,7 @@ public class ParticipantHandler {
var heartbeat = new ParticipantStatus();
heartbeat.setParticipantId(participantId);
heartbeat.setParticipantType(participantType);
- heartbeat.setHealthStatus(healthStatus);
- heartbeat.setState(state);
+ heartbeat.setState(ParticipantState.ON_LINE);
heartbeat.setAutomationCompositionInfoList(getAutomationCompositionInfoList());
if (responseToParticipantStatusReq) {