diff options
author | Liam Fallon <liam.fallon@est.tech> | 2021-09-29 20:25:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-09-29 20:25:58 +0000 |
commit | b84c75984991053a38f87446839914d0ed09ee30 (patch) | |
tree | ebdbd4d309c7557b88eddf5a43281aaaaa5c1576 /participant | |
parent | 94852ee6548e2efbefe943aa2a89f2b195d7d785 (diff) | |
parent | 54baeca8093cdf3502b778effe1bcb4350a860c9 (diff) |
Merge "Update Participant Status after Commissioning"
Diffstat (limited to 'participant')
-rw-r--r-- | participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java | 20 |
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() |