summaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
authorSirisha_Manchikanti <sirisha.manchikanti@est.tech>2021-09-10 15:38:07 +0100
committerLiam Fallon <liam.fallon@est.tech>2021-09-14 20:22:17 +0000
commitb741e69ad9a60a128d1994a6fcf65f0b6aeee7ee (patch)
tree14fbc25e98d3fd8843712527c691c3f96b96b38d /participant
parent16f9b97bda8300b354b7d156c084f9869191415f (diff)
Add Priming flag per controlloop
This commit adds a Priming flag per controlloop which indicates whether a controlLoop is primed or deprimed. There is a rest end-point added to depict in GUI Issue-ID: POLICY-3577 Signed-off-by: Sirisha_Manchikanti <sirisha.manchikanti@est.tech> Change-Id: Ie81a41505ab1eafda9515733e0b895421803ea8a
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java17
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java19
2 files changed, 21 insertions, 15 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
index 9054788f9..880514110 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
@@ -76,33 +76,36 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
*
* @param controlLoopElementId the ID of the control loop element
* @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
+ * @param orderedState the state to which the control loop element is changing to
* @throws PfModelException in case of an exception
*/
@Override
public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId,
UUID controlLoopElementId, ControlLoopState currentState,
- ControlLoopOrderedState newState) throws PfModelException {
- switch (newState) {
+ ControlLoopOrderedState orderedState) throws PfModelException {
+ switch (orderedState) {
case UNINITIALISED:
try {
- deletePolicyData(controlLoopId, controlLoopElementId, newState);
+ deletePolicyData(controlLoopId, controlLoopElementId, orderedState);
+ intermediaryApi.updateControlLoopElementState(controlLoopId,
+ controlLoopElementId, orderedState, ControlLoopState.UNINITIALISED,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
} catch (PfModelRuntimeException e) {
LOGGER.debug("Deleting policy data failed", e);
}
break;
case PASSIVE:
intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
+ controlLoopElementId, orderedState, ControlLoopState.PASSIVE,
ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
break;
case RUNNING:
intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
+ controlLoopElementId, orderedState, ControlLoopState.RUNNING,
ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
break;
default:
- LOGGER.debug("Unknown orderedstate {}", newState);
+ LOGGER.debug("Unknown orderedstate {}", orderedState);
break;
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
index 8bdf91824..30a06ba22 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
@@ -103,9 +103,11 @@ public class ControlLoopHandler {
return null;
}
+ // Update states of ControlLoopElement in controlLoopMap
for (var controlLoop : controlLoopMap.values()) {
var element = controlLoop.getElements().get(id);
if (element != null) {
+ element.setOrderedState(orderedState);
element.setState(newState);
}
var checkOpt = controlLoop.getElements().values().stream()
@@ -116,6 +118,7 @@ public class ControlLoopHandler {
}
}
+ // Update states of ControlLoopElement in elementsOnThisParticipant
var clElement = elementsOnThisParticipant.get(id);
if (clElement != null) {
var controlLoopStateChangeAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
@@ -339,16 +342,16 @@ public class ControlLoopHandler {
return;
}
- for (var clElementListener : listeners) {
- try {
- for (var element : controlLoop.getElements().values()) {
- clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(), element.getId(),
- element.getState(), orderedState);
+ controlLoop.getElements().values().stream().forEach(clElement -> {
+ for (var clElementListener : listeners) {
+ try {
+ clElementListener.controlLoopElementStateChange(controlLoop.getDefinition(),
+ clElement.getId(), clElement.getState(), orderedState);
+ } catch (PfModelException e) {
+ LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
}
- } catch (PfModelException e) {
- LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
}
- }
+ });
}
/**