summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2022-02-14 19:18:37 +0530
committerLathish <lathishbabu.ganesan@est.tech>2022-02-14 22:13:10 +0530
commitd2ed26dbefa7ae3dffcddb427ced9d412fea2a8b (patch)
tree2cea1ab7b003a1eee498b27175f62d47838c5a00
parentddfb2ef4b1308349910b9f9436bc1bdcc10fce6a (diff)
Fix Policy Participant to create and deploy the policies in Passive state
Issue-ID: POLICY-3874 Change-Id: If8a8a85dcb61389114a14c207c29ca55ba73161f Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java19
1 files changed, 7 insertions, 12 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 901fb682b..663d6d5e9 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -83,21 +83,21 @@ 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 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 orderedState) throws PfModelException {
+ ControlLoopOrderedState orderedState) {
switch (orderedState) {
case UNINITIALISED:
try {
+ undeployPolicies(controlLoopElementId);
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);
+ LOGGER.debug("Undeploying/Deleting policy failed {}", controlLoopElementId, e);
}
break;
case PASSIVE:
@@ -111,11 +111,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
break;
case RUNNING:
- try {
- deployPolicies(controlLoopId, controlLoopElementId, orderedState);
- } catch (PfModelRuntimeException e) {
- LOGGER.debug("Deploying policies failed {}", controlLoopElementId);
- }
+ LOGGER.info("Running state is not supported");
break;
default:
LOGGER.debug("Unknown orderedstate {}", orderedState);
@@ -153,7 +149,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
LOGGER.debug("No policies to deploy to {}", controlLoopElementId);
}
intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
+ controlLoopElementId, newState, ControlLoopState.PASSIVE,
ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
}
@@ -181,8 +177,6 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
ToscaNodeTemplate clElementDefinition)
throws PfModelException {
- intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(), element.getOrderedState(),
- ControlLoopState.PASSIVE, ParticipantMessageType.CONTROL_LOOP_UPDATE);
ToscaServiceTemplate controlLoopDefinition = element.getToscaServiceTemplateFragment();
if (controlLoopDefinition.getToscaTopologyTemplate() != null) {
if (controlLoopDefinition.getPolicyTypes() != null) {
@@ -205,6 +199,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
apiHttpClient.createPolicy(controlLoopDefinition);
}
}
+ deployPolicies(controlLoopId, element.getId(), element.getOrderedState());
}
/**