aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2020-02-06 12:16:20 -0600
committerjhh <jorge.hernandez-herrero@att.com>2020-02-06 12:17:07 -0600
commitfa4292c3b2a85d0cd8a5536462ea6081ae09c1e2 (patch)
tree88759d92a7f2df70302c266d9f81012ed218516e
parentdb4f17f190e542ecdffc8ad0b41c9421a275bf09 (diff)
Use CanonicalOnset in usecases.drl
Issue-ID: POLICY-2323 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Ic1258e17c08eacbf8d3a57a6562ba470420e615f
-rw-r--r--controlloop/common/controller-usecases/src/main/resources/usecases.drl34
-rw-r--r--controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties5
2 files changed, 16 insertions, 23 deletions
diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
index be009c55e..e070b0219 100644
--- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl
+++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
@@ -23,6 +23,7 @@ package org.onap.policy.controlloop;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
+import org.onap.policy.controlloop.CanonicalOnset;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.ControlLoopEventStatus;
@@ -157,7 +158,7 @@ end
rule "EVENT"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
not ( ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() ) )
then
@@ -190,8 +191,6 @@ rule "EVENT"
// Retract it from memory
//
retract($event);
- } else if ($event.getClosedLoopEventStatus() != ControlLoopEventStatus.ONSET) {
- throw new ControlLoopException($event.getClosedLoopEventStatus() + " received with no prior onset");
} else {
//
// Create an EventManager
@@ -818,8 +817,7 @@ end
rule "GUARD.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName,
- closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(),
@@ -886,8 +884,7 @@ end
rule "APPC.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName,
- closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(),
@@ -981,7 +978,7 @@ rule "APPC.RESPONSE.CLEANUP"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
$response : Response($id : getCommonHeader().RequestId )
- not ( VirtualControlLoopEvent( requestId == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
+ not ( CanonicalOnset( requestId == $id ) )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
@@ -1003,8 +1000,7 @@ end
rule "APPC.LCM.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName,
- closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(),
@@ -1090,7 +1086,7 @@ rule "APPC.LCM.RESPONSE.CLEANUP"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
$response : AppcLcmDmaapWrapper($id : getBody().getOutput().getCommonHeader().getRequestId() )
- not ( VirtualControlLoopEvent( requestId == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
+ not ( CanonicalOnset( requestId == $id ) )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
@@ -1111,8 +1107,7 @@ end
rule "SO.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName,
- closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(),
@@ -1198,8 +1193,7 @@ end
rule "VFC.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName,
- closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(),
@@ -1273,7 +1267,7 @@ end
rule "SDNC.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName, closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() )
$opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(),
@@ -1344,8 +1338,7 @@ end
rule "${policyName}.CDS.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(),
- closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $params.getClosedLoopControlName() )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(),
@@ -1614,8 +1607,7 @@ end
rule "SDNR.RESPONSE"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $event : VirtualControlLoopEvent( closedLoopControlName == $clName,
- closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $event : CanonicalOnset( closedLoopControlName == $clName )
$manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId() )
$operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(),
@@ -1704,7 +1696,7 @@ rule "SDNR.RESPONSE.CLEANUP"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
$response : PciResponseWrapper($id : getBody().getCommonHeader().getRequestId )
- not ( VirtualControlLoopEvent( requestId == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
+ not ( CanonicalOnset( requestId == $id ) )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
diff --git a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties
index 236ff61f9..174e8f202 100644
--- a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties
+++ b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties
@@ -25,8 +25,9 @@ dmaap.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP
dmaap.source.topics.DCAE_TOPIC.effectiveTopic=${env:DCAE_TOPIC}
dmaap.source.topics.DCAE_TOPIC.servers=${env:DMAAP_SERVERS}
dmaap.source.topics.DCAE_TOPIC.consumerGroup=${env:DCAE_CONSUMER_GROUP}
-dmaap.source.topics.DCAE_TOPIC.events=org.onap.policy.controlloop.VirtualControlLoopEvent
-dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.VirtualControlLoopEvent.filter=[?($.closedLoopEventStatus)]
+dmaap.source.topics.DCAE_TOPIC.events=org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated
+dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.filter=[?($.closedLoopEventStatus == 'ONSET')]
+dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.filter=[?($.closedLoopEventStatus == 'ABATED')]
dmaap.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson
dmaap.source.topics.DCAE_TOPIC.https=true