From b189f5f518bbc98c4c451861c7b0c1ba397d618d Mon Sep 17 00:00:00 2001 From: Guangrong Fu Date: Mon, 24 Jan 2022 15:07:08 +0800 Subject: [HOLMES] Remove DCAE-CBS Dependencies Completed the final phase of the Helm transformation of DCAE services. Issue-ID: HOLMES-488 Signed-off-by: Guangrong Fu Change-Id: I6b54d287ea71820d460cc290ee392aa842690d10 --- .../holmes-rule-mgmt/resources/config/cfy.json | 6 -- ...-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b.drl | 88 ++++++++++++++++++++++ .../holmes-rule-mgmt/resources/rules/index.json | 6 ++ 3 files changed, 94 insertions(+), 6 deletions(-) delete mode 100644 kubernetes/holmes/components/holmes-rule-mgmt/resources/config/cfy.json create mode 100644 kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b.drl create mode 100644 kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/index.json (limited to 'kubernetes/holmes/components/holmes-rule-mgmt/resources') diff --git a/kubernetes/holmes/components/holmes-rule-mgmt/resources/config/cfy.json b/kubernetes/holmes/components/holmes-rule-mgmt/resources/config/cfy.json deleted file mode 100644 index 8710f81d1b..0000000000 --- a/kubernetes/holmes/components/holmes-rule-mgmt/resources/config/cfy.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "holmes.default.rule.volte.scenario1": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b$$$package org.onap.holmes.droolsRule;\n\nimport org.onap.holmes.common.dmaap.DmaapService;\nimport org.onap.holmes.common.api.stat.VesAlarm;\nimport org.onap.holmes.common.aai.CorrelationUtil;\nimport org.onap.holmes.common.dmaap.entity.PolicyMsg;\nimport org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;\nimport org.onap.holmes.common.utils.DroolsLog;\n \n\nrule \"Relation_analysis_Rule\"\nsalience 200\nno-loop true\n when\n $root : VesAlarm(alarmIsCleared == 0,\n $sourceId: sourceId, sourceId != null && !sourceId.equals(\"\"),\n\t\t\t$sourceName: sourceName, sourceName != null && !sourceName.equals(\"\"),\n\t\t\t$startEpochMicrosec: startEpochMicrosec,\n eventName in (\"Fault_MultiCloud_VMFailure\"),\n $eventId: eventId)\n $child : VesAlarm( eventId != $eventId, parentId == null,\n CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, $sourceId, $sourceName),\n eventName in (\"Fault_MME_eNodeB out of service alarm\"),\n startEpochMicrosec < $startEpochMicrosec + 60000 && startEpochMicrosec > $startEpochMicrosec - 60000 )\n then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"Relation_analysis_Rule: rootId=\" + $root.getEventId() + \", childId=\" + $child.getEventId());\n\t\t$child.setParentId($root.getEventId());\n\t\tupdate($child);\n\t\t\nend\n\nrule \"root_has_child_handle_Rule\"\nsalience 150\nno-loop true\n\twhen\n\t\t$root : VesAlarm(alarmIsCleared == 0, rootFlag == 0, $eventId: eventId)\n\t\t$child : VesAlarm(eventId != $eventId, parentId == $eventId)\n\tthen\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"root_has_child_handle_Rule: rootId=\" + $root.getEventId() + \", childId=\" + $child.getEventId());\n\t\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, $child, \"org.onap.holmes.droolsRule\");\n dmaapService.publishPolicyMsg(policyMsg, \"dcae_cl_out\");\n\t\t$root.setRootFlag(1);\n\t\tupdate($root);\nend\n\nrule \"root_no_child_handle_Rule\"\nsalience 100\nno-loop true\n when\n $root : VesAlarm(alarmIsCleared == 0, rootFlag == 0,\n sourceId != null && !sourceId.equals(\"\"),\n\t\t\tsourceName != null && !sourceName.equals(\"\"),\n eventName in (\"Fault_MultiCloud_VMFailure\"))\n then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"root_no_child_handle_Rule: rootId=\" + $root.getEventId());\n\t\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, \"org.onap.holmes.droolsRule\");\n dmaapService.publishPolicyMsg(policyMsg, \"dcae_cl_out\");\n\t\t$root.setRootFlag(1);\n\t\tupdate($root);\nend\n\nrule \"root_cleared_handle_Rule\"\nsalience 100\nno-loop true\n when\n $root : VesAlarm(alarmIsCleared == 1, rootFlag == 1)\n then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"root_cleared_handle_Rule: rootId=\" + $root.getEventId());\n\t\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, \"org.onap.holmes.droolsRule\");\n dmaapService.publishPolicyMsg(policyMsg, \"dcae_cl_out\");\n\t\tretract($root);\nend\n\nrule \"child_handle_Rule\"\nsalience 100\nno-loop true\n when\n $child : VesAlarm(alarmIsCleared == 1, rootFlag == 0)\n then\n\t\tDroolsLog.printInfo(\"===========================================================\");\n\t\tDroolsLog.printInfo(\"child_handle_Rule: childId=\" + $child.getEventId());\n\t\tretract($child);\nend", - "services_calls": {}, - "streams_publishes": {}, - "streams_subscribes": {} -} diff --git a/kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b.drl b/kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b.drl new file mode 100644 index 0000000000..494333c2a8 --- /dev/null +++ b/kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b.drl @@ -0,0 +1,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 diff --git a/kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/index.json b/kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/index.json new file mode 100644 index 0000000000..70f9dd09db --- /dev/null +++ b/kubernetes/holmes/components/holmes-rule-mgmt/resources/rules/index.json @@ -0,0 +1,6 @@ +[ + { + "closedControlLoopName": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b", + "file": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b.drl" + } +] -- cgit 1.2.3-korg