aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2021-09-29 09:20:28 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2021-09-29 10:01:06 +0000
commit54baeca8093cdf3502b778effe1bcb4350a860c9 (patch)
treec55ccbff8bc6fbd669fb55c084e781d696f8aedb /participant/participant-intermediary
parent2e1d9ec7bf612998b7316d2c3395e824b372044e (diff)
Update Participant Status after Commissioning
Issue-ID: POLICY-3686 Change-Id: Ia9d8c345412c9d4d5017a6931565d57b16ec0c03 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/controlloop/participant/intermediary/handler/ParticipantHandler.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
index ea7d84501..0734cb9c7 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
@@ -262,14 +262,19 @@ 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)) {
+ if (ParticipantState.UNKNOWN.equals(this.state) || ParticipantState.TERMINATED.equals(this.state)) {
this.state = ParticipantState.PASSIVE;
}
- publisher.sendParticipantStatus(makeHeartbeat(false));
+
}
/**
@@ -303,6 +308,7 @@ public class ParticipantHandler {
participantUpdateMsg.getParticipantId());
if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
+ statusToPassive();
// This message is to commission the controlloop
for (ParticipantDefinition participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantType().equals(participantType)) {
@@ -311,7 +317,7 @@ public class ParticipantHandler {
}
}
} else {
- // This message is to decommision the controlloop
+ // This message is to decommission the controlloop
clElementDefsOnThisParticipant.clear();
this.state = ParticipantState.TERMINATED;
}
@@ -374,12 +380,12 @@ public class ParticipantHandler {
private List<ControlLoopInfo> getControlLoopInfoList() {
List<ControlLoopInfo> controlLoopInfoList = new ArrayList<>();
- for (Map.Entry<ToscaConceptIdentifier, ControlLoop> entry : controlLoopHandler.getControlLoopMap().entrySet()) {
- ControlLoopInfo clInfo = new ControlLoopInfo();
+ for (var entry : controlLoopHandler.getControlLoopMap().entrySet()) {
+ var clInfo = new ControlLoopInfo();
clInfo.setControlLoopId(entry.getKey());
- ControlLoopStatistics clStatitistics = new ControlLoopStatistics();
+ var clStatitistics = new ControlLoopStatistics();
clStatitistics.setControlLoopId(entry.getKey());
- ClElementStatisticsList clElementStatisticsList = new ClElementStatisticsList();
+ var clElementStatisticsList = new ClElementStatisticsList();
clElementStatisticsList
.setClElementStatistics(entry.getValue().getElements().values()
.stream()