summaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases/src/main/resources
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-09-05 12:06:55 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-05 12:06:55 +0000
commit77acba0514c6aeb13dcb8a6ab03f22052eba4478 (patch)
tree69f75cdc4f3e767843ab9bebbe6948a366cb8a25 /controlloop/common/controller-usecases/src/main/resources
parent7394337bf875e7dd7caae65533b7c32196f1542c (diff)
parentda3ffabb02a1b1823557dcf179fbef613706dfc4 (diff)
Merge "Changes drl files"
Diffstat (limited to 'controlloop/common/controller-usecases/src/main/resources')
-rw-r--r--controlloop/common/controller-usecases/src/main/resources/usecases.drl23
1 files changed, 21 insertions, 2 deletions
diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
index 37d7b6936..02161b8c3 100644
--- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl
+++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
@@ -36,6 +36,7 @@ import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager;
import org.onap.policy.controlloop.utils.ControlLoopUtils;
import org.onap.policy.controlloop.actor.so.SoActorServiceProvider;
import org.onap.policy.aai.AaiNqResponseWrapper;
+import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.CommonHeader;
@@ -729,6 +730,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
// NOTE: The environment properties uses "guard.disabled" but the boolean is guardEnabled
boolean guardEnabled = "false".equalsIgnoreCase(PolicyEngineConstants.getManager().getEnvironmentProperty("guard.disabled"));
+ boolean cqEnabled = "true".equalsIgnoreCase(PolicyEngineConstants.getManager().getEnvironmentProperty("aai.customQuery"));
if(guardEnabled){
@@ -740,8 +742,25 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED"
$operation.getTargetEntity(),
$event.getRequestId().toString(),
() -> {
- AaiNqResponseWrapper resp = $manager.getNqVserverFromAai();
- return(resp == null ? null : resp.countVfModules());
+ if (!cqEnabled) {
+ AaiNqResponseWrapper resp = $manager.getNqVserverFromAai();
+ return(resp == null ? null : resp.countVfModules());
+ } else {
+ try {
+ AaiCqResponse resp_cq = $manager.getCqResponse($event);
+ if (resp_cq == null){
+ return null;
+ } else {
+ String custId = $operation.policy.getTarget().getModelCustomizationId();
+ String invId = $operation.policy.getTarget().getModelInvariantId();
+ String verId = $operation.policy.getTarget().getModelVersionId();
+ return resp_cq.getVfModuleCount(custId, invId, verId);
+ }
+ } catch (Exception e){
+ logger.warn("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName(), e);
+ }
+ return null;
+ }
}));
t.start();
}