summaryrefslogtreecommitdiffstats
path: root/controlloop/templates/template.demo/src/main/resources
diff options
context:
space:
mode:
authordaniel <dc443y@att.com>2017-09-28 10:01:21 -0500
committerdaniel <dc443y@att.com>2017-09-28 10:57:26 -0500
commit788289af4cbe6d288f6dadb9e1eca4ee2740a30d (patch)
treef99cb9f83fcba03ca5e74be49ee9a5b5f64838da /controlloop/templates/template.demo/src/main/resources
parent400ca9b5ebb98c42c0c497d917f3cf139b03888a (diff)
Fix Retries for Policies
This applies changes to make retries work properly for all control loops. The current design was ignoring the upper bound of the retries and retrying until either a success or control loop timeout occured. This is now fixed to only do retries until the limit is reached that is specified from the policy. The operation is now started in the GUARD.PERMITTED rule. I think this is better because it stops Policy from doing extra processing if there is a guard deny. This is also needed so that we can properly do retries for all cases. The notifications sent in GUARD_NOT_YET_QUERIED and GUARD.RESPONSE are now more informative with the message specifying the actor and recipe. The not queried rule has a message stating that we are sending a query to guard and the guard response message in the guard response rule specifices the result from guard. During a retest of vDNS it appeared that the archetype template was no longer working, this was because there were changes in the JUnit template that were not reflected in the archetype template. These were added to archetype and vDNS is verified to work again. Another small fix needed was making sure the action for vCPE is "Restart" instead of "restart". APPC will reject our request if "Restart" is not sent as the action. Issue-ID: POLICY-259 Change-Id: I28dd3c9a629d297b408775a01afadd5c19351e37 Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop/templates/template.demo/src/main/resources')
-rw-r--r--controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl14
1 files changed, 4 insertions, 10 deletions
diff --git a/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
index 03a38e5dc..6916524b5 100644
--- a/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
+++ b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
@@ -487,7 +487,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
Logger.metrics($lock);
- Object request = $operation.getOperationRequest();
+ Object request = $operation.startOperation($event);
if (request != null) {
Logger.info("Starting operation");
@@ -561,19 +561,13 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
Logger.metrics($manager);
Logger.metrics($operation);
Logger.metrics($lock);
-
-
- //
- // We are starting the operation but the actor won't be contacted until Guard is queried and permitted.
- //
- $operation.startOperation($event);
//
// Sending notification that we are about to query Guard ("DB write - start operation")
//
VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
notification.notification = ControlLoopNotificationType.OPERATION;
- notification.message = $operation.getOperationMessage();
+ notification.message = "Sending guard query for " + $operation.policy.getActor() + " " + $operation.policy.getRecipe();
notification.history = $operation.getHistory();
notification.from = "policy";
notification.policyName = drools.getRule().getName();
@@ -637,7 +631,7 @@ rule "${policyName}.GUARD.RESPONSE"
//we will permit the operation if there was no Guard for it
- if("Indeterminate".equals($guardResponse.result)){
+ if("Indeterminate".equalsIgnoreCase($guardResponse.result)){
$guardResponse.result = "Permit";
}
@@ -646,7 +640,7 @@ rule "${policyName}.GUARD.RESPONSE"
//
VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
notification.notification = ControlLoopNotificationType.OPERATION;
- notification.message = $operation.getOperationMessage($guardResponse.result);
+ notification.message = "Guard result for " + $operation.policy.getActor() + " " + $operation.policy.getRecipe() + " is " + $guardResponse.result;
notification.history = $operation.getHistory();
notification.from = "policy";
notification.policyName = drools.getRule().getName();