aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-09-02 14:15:47 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-02 14:15:47 +0000
commit2c1abacecc2ad328288cbb0b4e1cba89157301ee (patch)
tree487ff4c64f5145c787add7afc4d3035bd4622248 /controlloop/common/controller-usecases
parenta588736799d94747f70ed648d3d821210993c5c4 (diff)
parent25c8a555a739b1c80966ed88cc123a6e9ad9318e (diff)
Merge "Allow guards to be dynamically enabled/disabled"
Diffstat (limited to 'controlloop/common/controller-usecases')
-rw-r--r--controlloop/common/controller-usecases/src/main/resources/usecases.drl16
1 files changed, 15 insertions, 1 deletions
diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
index d3365e6cc..12c9849f9 100644
--- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl
+++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop;
+import java.time.Instant;
import java.util.Collections;
import java.util.stream.Collectors;
import org.onap.policy.controlloop.CanonicalOnset;
@@ -32,6 +33,7 @@ import org.onap.policy.controlloop.actor.aai.AaiGetTenantOperation;
import org.onap.policy.controlloop.actor.guard.GuardActor;
import org.onap.policy.controlloop.actor.guard.DecisionOperation;
import org.onap.policy.controlloop.actorserviceprovider.Operation;
+import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.OperationFinalResult;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
@@ -388,7 +390,19 @@ rule "EVENT.MANAGER.EXECUTE.STEP"
$step.init();
$step.setProperties();
- if ($manager.executeStep()) {
+ boolean guardDisabled = "true".equalsIgnoreCase(
+ PolicyEngineConstants.getManager().getEnvironmentProperty("guard.disabled"));
+
+ if (guardDisabled && "GUARD".equals($step.getActorName())) {
+ // guard is disabled - just enqueue a "SUCCESS" (i.e., "Permit")
+ OperationOutcome outcome = $step.getParams().makeOutcome();
+ outcome.setStart(Instant.now());
+ outcome.setEnd(outcome.getStart());
+
+ $manager.getOutcomes().add(outcome);
+ $manager.setState(State.AWAITING_OUTCOME);
+
+ } else if ($manager.executeStep()) {
$manager.setState(State.AWAITING_OUTCOME);
} else {