diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-12-14 17:33:57 +0000 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2024-03-08 16:14:43 +0000 |
commit | b75038fab6ae0816413ed9f925639f3befe4fddb (patch) | |
tree | b6867f9a3be4f7aacaa2eaa2a7d1440097ac87e7 /participant/participant-intermediary/src | |
parent | 33751b41710ad0b31ee3b4aa8346591d5ecb36ad (diff) |
Update compositions and instances monitoring
Improved performance scanning only compositions and instances
that are in transition.
Issue-ID: POLICY-4906
Change-Id: I7a849e921f1d97509f67ff624c715c893a1432ab
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src')
2 files changed, 25 insertions, 1 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java index fd82c37ba..fefa637da 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java @@ -40,6 +40,7 @@ import org.onap.policy.clamp.models.acm.concepts.DeployState; import org.onap.policy.clamp.models.acm.concepts.LockState; import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc; +import org.onap.policy.clamp.models.acm.concepts.ParticipantState; import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils; import org.onap.policy.clamp.models.acm.concepts.StateChangeResult; import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionDeploy; @@ -47,6 +48,7 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCom import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionMigration; import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionStateChange; import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageType; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantPrimeAck; import org.onap.policy.clamp.models.acm.messages.kafka.participant.PropertiesUpdate; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder; @@ -428,6 +430,16 @@ public class AutomationCompositionHandler { var acElementsDefinitions = cacheProvider.getAcElementsDefinitions().get(compositionId); if (acElementsDefinitions == null) { // this participant does not handle this composition + var participantPrimeAck = new ParticipantPrimeAck(); + participantPrimeAck.setCompositionId(compositionId); + participantPrimeAck.setMessage("Already deprimed or never primed"); + participantPrimeAck.setResult(true); + participantPrimeAck.setResponseTo(messageId); + participantPrimeAck.setCompositionState(AcTypeState.COMMISSIONED); + participantPrimeAck.setStateChangeResult(StateChangeResult.NO_ERROR); + participantPrimeAck.setParticipantId(cacheProvider.getParticipantId()); + participantPrimeAck.setState(ParticipantState.ON_LINE); + publisher.sendParticipantPrimeAck(participantPrimeAck); return; } var list = new ArrayList<>(acElementsDefinitions.values()); diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java index 661c009f6..b8fd3b42d 100644 --- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java +++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java @@ -47,6 +47,7 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCom import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionDeployAck; import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionMigration; import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionStateChange; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantPrimeAck; import org.onap.policy.clamp.models.acm.messages.kafka.participant.PropertiesUpdate; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder; @@ -273,7 +274,7 @@ class AutomationCompositionHandlerTest { } @Test - void handleComposiotDeprimeTest() { + void handleCompositionDeprimeTest() { var acElementDefinition = new AutomationCompositionElementDefinition(); acElementDefinition.setAcElementDefinitionId(new ToscaConceptIdentifier("key", "1.0.0")); var toscaNodeTemplate = new ToscaNodeTemplate(); @@ -292,6 +293,17 @@ class AutomationCompositionHandlerTest { } @Test + void handleCompositionAlreadyDeprimedTest() { + var messageId = UUID.randomUUID(); + var compositionId = UUID.randomUUID(); + var participantMessagePublisher = mock(ParticipantMessagePublisher.class); + var ach = new AutomationCompositionHandler(mock(CacheProvider.class), participantMessagePublisher, + mock(ThreadHandler.class)); + ach.deprime(messageId, compositionId); + verify(participantMessagePublisher).sendParticipantPrimeAck(any(ParticipantPrimeAck.class)); + } + + @Test void restartedTest() { var acElementDefinition = new AutomationCompositionElementDefinition(); acElementDefinition.setAcElementDefinitionId(new ToscaConceptIdentifier("key", "1.0.0")); |