diff options
author | GuangrongFu <fu.guangrong@zte.com.cn> | 2018-09-13 10:39:35 +0800 |
---|---|---|
committer | GuangrongFu <fu.guangrong@zte.com.cn> | 2018-09-13 10:39:35 +0800 |
commit | 3a9ad3ee712a697f1693cab61e22085dc5506bce (patch) | |
tree | 301a5fcc2cd1e76b9393f47de49ecd7bdcdfae9d | |
parent | 2ec931c5317ece0edeaa314145a71ddab8978d73 (diff) |
Submitting the VoLTE Rule
Change-Id: Ibcecf28d62354a084fc313dad0be12da4ee0db35
Issue-ID: HOLMES-167
Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
-rw-r--r-- | rules/volte-rule.drl | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/rules/volte-rule.drl b/rules/volte-rule.drl new file mode 100644 index 0000000..7f1ab4f --- /dev/null +++ b/rules/volte-rule.drl @@ -0,0 +1,84 @@ +package org.onap.holmes.droolsRule; + +import org.onap.holmes.common.dmaap.DmaapService; +import org.onap.holmes.common.api.stat.VesAlarm; +import org.onap.holmes.common.aai.CorrelationUtil; +import org.onap.holmes.common.dmaap.entity.PolicyMsg; +import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder; +import org.onap.holmes.common.utils.DroolsLog; + + +rule "Relation_analysis_Rule" +salience 200 +no-loop true + when + $root : VesAlarm(alarmIsCleared == 0, + $sourceId: sourceId, sourceId != null && !sourceId.equals(""), + $sourceName: sourceName, sourceName != null && !sourceName.equals(""), + $startEpochMicrosec: startEpochMicrosec, + eventName in ("Fault_MultiCloud_VMFailure"), + $eventId: eventId) + $child : VesAlarm( eventId != $eventId, parentId == null, + CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, $sourceId, $sourceName), + eventName in ("Fault_IMSSBC_Backup MPU is down"), + startEpochMicrosec < $startEpochMicrosec + 600000000 && startEpochMicrosec > $startEpochMicrosec - 600000000 ) + then + DroolsLog.printInfo("Correlation Identified: Root: ID=" + $root.getEventId() + ", Event Name=" + $root.getEventName() +"; Child: ID=" + $child.getEventId() + ", Event Name=" + $child.getEventName()); + $child.setParentId($root.getEventId()); + update($child); +end + +rule "root_has_child_handle_Rule" +salience 150 +no-loop true + when + $root : VesAlarm(alarmIsCleared == 0, rootFlag == 0, $eventId: eventId) + $child : VesAlarm(eventId != $eventId, parentId == $eventId) + then + DroolsLog.printInfo("Root alarm: ID=" + $root.getEventId() + ", Event Name=" + $root.getEventName()); + DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class); + PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, $child, "org.onap.holmes.droolsRule"); + dmaapService.publishPolicyMsg(policyMsg, "unauthenticated.DCAE_CL_OUTPUT"); + $root.setRootFlag(1); + update($root); +end + +rule "root_no_child_handle_Rule" +salience 100 +no-loop true + when + $root : VesAlarm(alarmIsCleared == 0, rootFlag == 0, + sourceId != null && !sourceId.equals(""), + sourceName != null && !sourceName.equals(""), + eventName in ("Fault_MultiCloud_VMFailure")) + then + DroolsLog.printInfo("New alarm: ID=" + $root.getEventId() + ", Event Name=" + $root.getEventName()); + DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class); + PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, "org.onap.holmes.droolsRule"); + dmaapService.publishPolicyMsg(policyMsg, "unauthenticated.DCAE_CL_OUTPUT"); + $root.setRootFlag(1); + update($root); +end + +rule "root_cleared_handle_Rule" +salience 100 +no-loop true + when + $root : VesAlarm(alarmIsCleared == 1, rootFlag == 1) + then + DroolsLog.printInfo("Alarm cleared: ID=" + $root.getEventId() + ", Event Name=" + $root.getEventName()); + DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class); + PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, "org.onap.holmes.droolsRule"); + dmaapService.publishPolicyMsg(policyMsg, "unauthenticated.DCAE_CL_OUTPUT"); + retract($root); +end + +rule "child_handle_Rule" +salience 100 +no-loop true + when + $child : VesAlarm(alarmIsCleared == 1, rootFlag == 0) + then + DroolsLog.printInfo("Alarm cleared: ID=" + $child.getEventId() + ", Event Name=" + $child.getEventName()); + retract($child); +end
\ No newline at end of file |