summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-09-28 19:43:03 -0500
committerJorge Hernandez <jh1730@att.com>2017-09-28 22:37:51 -0500
commit2d8b2ae94cd6fd5f1da54480e5a4e2cadbc369f9 (patch)
treeadabb43274ba2ae5afdbe67e6aba89fc16116a38
parent43f490a5de00a5e15bcdc5749e8940b6729dc6df (diff)
update to the latest drl
Change-Id: I80b53b794832f9f440d60b33ff3958553ef5591f Issue-ID: POLICY-264 Signed-off-by: Jorge Hernandez <jh1730@att.com>
-rw-r--r--config/pe/ClosedLoopControlName.drl36
1 files changed, 16 insertions, 20 deletions
diff --git a/config/pe/ClosedLoopControlName.drl b/config/pe/ClosedLoopControlName.drl
index c1af5cb1..3273dc6c 100644
--- a/config/pe/ClosedLoopControlName.drl
+++ b/config/pe/ClosedLoopControlName.drl
@@ -114,7 +114,6 @@ rule "${policyName}.SETUP"
logger.info("{}: {} : YAML=[{}]", params.getClosedLoopControlName(), drools.getRule().getName(), params.getControlLoopYaml());
String sqlDbUsername = PolicyEngine.manager.getEnvironmentProperty("sql.db.username");
- String sqlDbPassword = PolicyEngine.manager.getEnvironmentProperty("sql.db.password");
String aaiUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url");
String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username");
@@ -129,15 +128,16 @@ rule "${policyName}.SETUP"
String vfcPassword = PolicyEngine.manager.getEnvironmentProperty("vfc.password");
String guardUrl = PolicyEngine.manager.getEnvironmentProperty("guard.url");
- String guardUsername = PolicyEngine.manager.getEnvironmentProperty("guard.username");
- String guardPassword = PolicyEngine.manager.getEnvironmentProperty("guard.password");
+ String guardUsername = PolicyEngine.manager.getEnvironmentProperty("pdpx.username");
+ String guardPassword = PolicyEngine.manager.getEnvironmentProperty("pdpx.password");
String guardJdbcUrl = PolicyEngine.manager.getEnvironmentProperty("guard.jdbc.url");
+ String guardDisabled = PolicyEngine.manager.getEnvironmentProperty("guard.disabled");
logger.info("{}: {} : AAI=[{}:{}]", params.getClosedLoopControlName(), drools.getRule().getName(), aaiUrl, aaiUsername);
logger.info("{}: {} : SO=[{}:{}]", params.getClosedLoopControlName(), drools.getRule().getName(), soUrl, soUsername);
logger.info("{}: {} : VFC=[{}:{}]", params.getClosedLoopControlName(), drools.getRule().getName(), vfcUrl, vfcUsername);
- logger.info("{}: {} : GUARD=[{}:{}:{}]", params.getClosedLoopControlName(), drools.getRule().getName(), guardUrl, guardUsername, guardJdbcUrl);
- logger.info("{}: {} : DB=[{}:{}]", params.getClosedLoopControlName(), drools.getRule().getName(), sqlDbUsername, sqlDbPassword);
+ logger.info("{}: {} : GUARD=[{}:{}:{}:{}]", params.getClosedLoopControlName(), drools.getRule().getName(), guardUrl, guardUsername, guardJdbcUrl, guardDisabled);
+ logger.info("{}: {} : DB=[{}]", params.getClosedLoopControlName(), drools.getRule().getName(), sqlDbUsername);
end
/*
@@ -506,7 +506,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() )
$manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID )
- $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID, getGuardApprovalStatus() == "Permit" )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID, "Permit".equalsIgnoreCase(getGuardApprovalStatus()) )
$lock : TargetLock (requestID == $event.requestID)
then
@@ -515,7 +515,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
$params.getClosedLoopControlName(), drools.getRule().getName(),
$event, $manager, $operation, $lock);
- Object request = $operation.getOperationRequest();
+ Object request = $operation.startOperation($event);
if (request != null) {
logger.debug("{}: {}: starting operation ..",
@@ -592,18 +592,13 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
logger.info("{}: {}: event={} manager={} operation={} lock={}",
$params.getClosedLoopControlName(), drools.getRule().getName(),
$event, $manager, $operation, $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();
@@ -620,12 +615,13 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
// to the CallGuardTask() and set the first argument to null
// (instead of XacmlPdpEngine).
//
- boolean guardEnabled = false;
+
+ // NOTE: The environment properties uses "guard.disabled" but the boolean is guardEnabled
+ boolean guardEnabled = "false".equalsIgnoreCase(PolicyEngine.manager.getEnvironmentProperty("guard.disabled"));
if(guardEnabled){
Thread t = new Thread(new org.onap.policy.guard.CallGuardTask(
- PolicyEngine.manager.getEnvironmentProperty("guard.url"),
drools.getWorkingMemory(),
$event.closedLoopControlName,
$operation.policy.getActor().toString(),
@@ -664,7 +660,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";
}
@@ -673,7 +669,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();
@@ -682,7 +678,7 @@ rule "${policyName}.GUARD.RESPONSE"
PolicyEngine.manager.deliver("POLICY-CL-MGT", notification);
- if("Permit".equals($guardResponse.result)){
+ if("Permit".equalsIgnoreCase($guardResponse.result)){
modify($operation){setGuardApprovalStatus($guardResponse.result)};
}
@@ -936,7 +932,7 @@ rule "${policyName}.SO.RESPONSE"
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
$opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
$lock : TargetLock (requestID == $event.requestID)
- $response : SOResponse( request.requestId == $event.requestID.toString() )
+ $response : SOResponse( requestReferences.requestId.toString() == $event.requestID.toString() )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
@@ -1224,4 +1220,4 @@ rule "${policyName}.EVENT.MANAGER.TIMEOUT"
retract(lock);
}
}
-end \ No newline at end of file
+end