summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/main
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-08-03 13:21:22 +0100
committerAdheli Tavares <adheli.tavares@est.tech>2023-08-08 09:53:04 +0000
commit092e94405aaeffb9c24b1d4037948d13ff19e7e3 (patch)
tree288f280f469310ffb14f8d55b4ecff0df19d0189 /runtime-acm/src/main
parent99416bab41ce90c7931fcf92b042296ba8b9e2e0 (diff)
Add support to save outProperties in AC Definition in ACM runtime
Add support to save outProperties in AC Definition from Participant Status message. Add outProperties support in restart message. Issue-ID: POLICY-4781 Change-Id: I9f9bed5c9c3e6692a1e4666162b752db95994f95 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/main')
-rwxr-xr-xruntime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java24
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java11
2 files changed, 34 insertions, 1 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
index f8bc233e9..ebccc2f66 100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
@@ -35,6 +35,7 @@ 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.AutomationCompositionDefinition;
import org.onap.policy.clamp.models.acm.concepts.Participant;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
@@ -130,6 +131,29 @@ public class SupervisionParticipantHandler {
if (!participantStatusMsg.getAutomationCompositionInfoList().isEmpty()) {
automationCompositionProvider.upgradeStates(participantStatusMsg.getAutomationCompositionInfoList());
}
+ if (!participantStatusMsg.getParticipantDefinitionUpdates().isEmpty()
+ && participantStatusMsg.getCompositionId() != null) {
+ updateAcDefinitionOutProperties(participantStatusMsg.getCompositionId(),
+ participantStatusMsg.getParticipantDefinitionUpdates());
+ }
+ }
+
+ private void updateAcDefinitionOutProperties(UUID composotionId, List<ParticipantDefinition> list) {
+ var acDefinitionOpt = acDefinitionProvider.findAcDefinition(composotionId);
+ if (acDefinitionOpt.isEmpty()) {
+ LOGGER.error("Ac Definition with id {} not found", composotionId);
+ return;
+ }
+ var acDefinition = acDefinitionOpt.get();
+ for (var acElements : list) {
+ for (var element : acElements.getAutomationCompositionElementDefinitionList()) {
+ var state = acDefinition.getElementStateMap().get(element.getAcElementDefinitionId().getName());
+ if (state != null) {
+ state.setOutProperties(element.getOutProperties());
+ }
+ }
+ }
+ acDefinitionProvider.updateAcDefinition(acDefinition);
}
private void checkOnline(Participant participant) {
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java
index b086b1914..c00116e3b 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java
@@ -100,6 +100,15 @@ public class ParticipantRestartPublisher extends AbstractParticipantPublisher<Pa
elementList.add(elementEntry);
}
}
- return AcmUtils.prepareParticipantPriming(elementList, supportedElementMap);
+ var list = AcmUtils.prepareParticipantPriming(elementList, supportedElementMap);
+ for (var participantDefinition : list) {
+ for (var elementDe : participantDefinition.getAutomationCompositionElementDefinitionList()) {
+ var state = acmDefinition.getElementStateMap().get(elementDe.getAcElementDefinitionId().getName());
+ if (state != null) {
+ elementDe.setOutProperties(state.getOutProperties());
+ }
+ }
+ }
+ return list;
}
}