...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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, specificProblem in (\"Fault_MultiCloud_VMFailure\"), $eventId: eventId) $child : VesAlarm( eventId != $eventId, parentId == null, CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, $sourceId, $sourceName), specificProblem in (\"Slave MPU is offline\"), startEpochMicrosec < $startEpochMicrosec + 60000 && startEpochMicrosec > $startEpochMicrosec - 60000 ) then $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 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(\"\"), specificProblem in (\"Fault_MultiCloud_VMFailure\")) then 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); nend rule "root_cleared_handle_Rule" salience 100 no-loop true when\n $root : VesAlarm(alarmIsCleared == 1, rootFlag == 1)\n then\n\t\tDmaapService DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, \"org.onap.holmes.droolsRule\");\n dmaapService.publishPolicyMsg(policyMsg, \"unauthenticated.DCAE_CL_OUTPUT\");\n\t\tretract retract($root);\nend\n\nrule \ end rule "child_handle_Rule\"\nsalience salience 100\nno no-loop true\n when\n $child : VesAlarm(alarmIsCleared == 1, rootFlag == 0)\n then\n\t\tretract retract($child);\nend end", |
Before install Holmes dockers, you need to installĀ postgres
...