summaryrefslogtreecommitdiffstats
path: root/runtime-controlloop/src/main/java/org
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2021-08-09 16:27:25 +0100
committerFrancescoFioraEst <francesco.fiora@est.tech>2021-08-11 16:16:31 +0100
commit20e2a1787c703a7957728e0c9a190a556b0ae536 (patch)
treeb3cd7221cb234e8ff6deb7394e200ce7aa5421a3 /runtime-controlloop/src/main/java/org
parent8a2f14ae90528454c4aa2351f8f4c1e04eaed2b6 (diff)
Fix serialization of messages in Control Loop and Participants
Issue-ID: POLICY-3536 Change-Id: I72207ba8b3894238412bf19c32b799b661a23c21 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-controlloop/src/main/java/org')
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java24
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java5
2 files changed, 15 insertions, 14 deletions
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
index 16dba0f07..9180cedb3 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
@@ -27,7 +27,6 @@ import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
@@ -312,17 +311,20 @@ public class SupervisionHandler {
private void superviseControlLoops(ParticipantStatus participantStatusMessage)
throws PfModelException, ControlLoopException {
- for (Map.Entry<ToscaConceptIdentifier, ControlLoopInfo> clEntry :
- participantStatusMessage.getControlLoopInfoMap().entrySet()) {
- var dbControlLoop = controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(
- clEntry.getKey().getName(), clEntry.getKey().getVersion()));
- if (dbControlLoop == null) {
- exceptionOccured(Response.Status.NOT_FOUND,
- "PARTICIPANT_STATUS control loop not found in database: " + clEntry.getKey());
+ if (participantStatusMessage.getControlLoopInfoMap() != null) {
+ for (Map.Entry<String, ControlLoopInfo> clEntry : participantStatusMessage.getControlLoopInfoMap()
+ .entrySet()) {
+ String[] key = clEntry.getKey().split(" ");
+ var dbControlLoop = controlLoopProvider.getControlLoop(
+ new ToscaConceptIdentifier(key[0], key[1]));
+ if (dbControlLoop == null) {
+ exceptionOccured(Response.Status.NOT_FOUND,
+ "PARTICIPANT_STATUS control loop not found in database: " + clEntry.getKey());
+ }
+ dbControlLoop.setState(clEntry.getValue().getState());
+ monitoringProvider.createClElementStatistics(clEntry.getValue().getControlLoopStatistics()
+ .getClElementStatisticsList().getClElementStatistics());
}
- dbControlLoop.setState(clEntry.getValue().getState());
- monitoringProvider.createClElementStatistics(clEntry.getValue()
- .getControlLoopStatistics().getClElementStatisticsList().getClElementStatistics());
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
index 88cf90d02..cfc0e3932 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -71,9 +71,8 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
Map<UUID, ControlLoopElementDefinition> controlLoopElementDefinitionMap = new LinkedHashMap<>();
controlLoopElementDefinitionMap.put(UUID.randomUUID(), clDefinition);
- Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>> participantDefinitionUpdateMap =
- new LinkedHashMap<>();
- participantDefinitionUpdateMap.put(participantId, controlLoopElementDefinitionMap);
+ Map<String, Map<UUID, ControlLoopElementDefinition>> participantDefinitionUpdateMap = new LinkedHashMap<>();
+ participantDefinitionUpdateMap.put(participantId.toString(), controlLoopElementDefinitionMap);
message.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
LOGGER.debug("Participant Update sent {}", message);