summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-http/src/main
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2021-09-29 10:46:54 +0100
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>2021-09-29 10:46:54 +0100
commit790f8caea5a9d862005951a86ef45ebd47d2b1f3 (patch)
treed94df1049854b5c326be9780b7b2139b64ec9282 /participant/participant-impl/participant-impl-http/src/main
parent2e1d9ec7bf612998b7316d2c3395e824b372044e (diff)
Fix CL state change failures on participants
Issue-ID: POLICY-3685 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: Ibec537d1ab55fd921481294fc3e193d7f1dc7912
Diffstat (limited to 'participant/participant-impl/participant-impl-http/src/main')
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java
index cfe786865..86a864efc 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java
@@ -37,6 +37,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
import org.onap.policy.clamp.controlloop.participant.http.main.webclient.ClHttpClient;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
@@ -90,7 +91,26 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl
@Override
public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId,
ControlLoopState currentState, ControlLoopOrderedState newState) throws PfModelException {
- // Implementation not needed for http participant
+ switch (newState) {
+ case UNINITIALISED:
+ intermediaryApi.updateControlLoopElementState(controlLoopId,
+ controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ break;
+ case PASSIVE:
+ intermediaryApi.updateControlLoopElementState(controlLoopId,
+ controlLoopElementId, newState, ControlLoopState.PASSIVE,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ break;
+ case RUNNING:
+ intermediaryApi.updateControlLoopElementState(controlLoopId,
+ controlLoopElementId, newState, ControlLoopState.RUNNING,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ break;
+ default:
+ LOGGER.warn("Cannot transition from state {} to state {}", currentState, newState);
+ break;
+ }
}
/**
@@ -108,6 +128,9 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl
.getValidator().validate(configRequest);
if (violations.isEmpty()) {
invokeHttpClient(configRequest);
+ intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(),
+ ControlLoopOrderedState.PASSIVE, ControlLoopState.PASSIVE,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
} else {
LOGGER.error("Violations found in the config request parameters: {}", violations);
throw new ValidationException("Constraint violations in the config request");