summaryrefslogtreecommitdiffstats
path: root/kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b.drl
blob: 494333c2a8687671e19ea7fb77729abcb88a9c85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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_MME_eNodeB out of service alarm"),
            startEpochMicrosec < $startEpochMicrosec + 60000 && startEpochMicrosec > $startEpochMicrosec - 60000 )
    then
        DroolsLog.printInfo("===========================================================");
        DroolsLog.printInfo("Relation_analysis_Rule: rootId=" + $root.getEventId() + ", childId=" + $child.getEventId());
        $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("===========================================================");
        DroolsLog.printInfo("root_has_child_handle_Rule: rootId=" + $root.getEventId() + ", childId=" + $child.getEventId());
        DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
        PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, $child, "org.onap.holmes.droolsRule");
        dmaapService.publishPolicyMsg(policyMsg, "dcae_cl_out");
        $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("===========================================================");
        DroolsLog.printInfo("root_no_child_handle_Rule: rootId=" + $root.getEventId());
        DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
        PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, "org.onap.holmes.droolsRule");
        dmaapService.publishPolicyMsg(policyMsg, "dcae_cl_out");
        $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("===========================================================");
        DroolsLog.printInfo("root_cleared_handle_Rule: rootId=" + $root.getEventId());
        DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
        PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, "org.onap.holmes.droolsRule");
        dmaapService.publishPolicyMsg(policyMsg, "dcae_cl_out");
        retract($root);
end

rule "child_handle_Rule"
salience 100
no-loop true
    when
        $child : VesAlarm(alarmIsCleared == 1, rootFlag == 0)
    then
        DroolsLog.printInfo("===========================================================");
        DroolsLog.printInfo("child_handle_Rule: childId=" + $child.getEventId());
        retract($child);
end