...
These alarms are published to the unauthenticated.SEC_FAULT_OUTPUT topic of DMaaP.
DCAE Blueprint
HOLMES (WIP)
CCVPN Close Loop requires Holmes to correlate route down alarms from SOTN Controllers from different sites. (Refer to this page on Holmes installation,)
In Phase 1, for the minimum, two of the above defined Route_Down_Alarm will be correlated within time window of 15 - 30, for instance, milliseconds. (Refer to this page as examples.)
Rule Creation
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "ruleName": "CCVPN", "loopControlName": "ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c55b", "description": "This rule is designed for the correlation analysis for the CCVPN use case.", "content": "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 specificProblem in (\"Fault_MultiCloud_VMFailure\"),\n $eventId: eventId)\n $child : VesAlarm( eventId != $eventId, parentId == null,\n CorrelationUtil.getInstance().isTopologicallyRelated(sourceId, $sourceId, $sourceName),\n specificProblem in (\"Slave MPU is offline\"),\n startEpochMicrosec < $startEpochMicrosec + 60000 && startEpochMicrosec > $startEpochMicrosec - 60000 )\n then\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\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, $child, \"org.onap.holmes.droolsRule\");\n dmaapService.publishPolicyMsg(policyMsg, \"unauthenticated.DCAE_CL_OUTPUT\");\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 specificProblem in (\"Fault_MultiCloud_VMFailure\"))\n then\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, \"unauthenticated.DCAE_CL_OUTPUT\");\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\tDmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);\n\t\tPolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, \"org.onap.holmes.droolsRule\");\n dmaapService.publishPolicyMsg(policyMsg, \"unauthenticated.DCAE_CL_OUTPUT\");\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\tretract($child);\nend", "enabled": 1 } |
To illustrate, the content field in the above rule is presented as readable format in the following. We need to convert it to valid json string when uploading to Holmes.
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
$root : VesAlarm(alarmIsCleared == 1, rootFlag == 1)
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");
retract($root);
end
rule "child_handle_Rule"
salience 100
no-loop true
when
$child : VesAlarm(alarmIsCleared == 1, rootFlag == 0)
then
retract($child);
end |
Rule Execution
After the correlation is done successfully, there should be a corresponding control loop event defined in the following section published on the unauthenticated.DCAE_CL_OUTPUT topic of DMaaP.
...