diff options
author | 2017-11-10 14:25:16 +0800 | |
---|---|---|
committer | 2017-11-10 14:25:16 +0800 | |
commit | 449744265f24a4d3337115240ae4e834594c50a2 (patch) | |
tree | 02a18a72206e297eea8ccd68b29d428815ec70fd /holmes-actions/src/main | |
parent | ee62cd0ae490e27d461d50258805dc37c5de0d3b (diff) |
Fix Some Bug
Add more info to the CL event even the AAI
info is partly unavailable.
Change-Id: I61a6ee8e0e1a5c9e7b3416646140d61a948f5424
Issue-ID: HOLMES-85
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'holmes-actions/src/main')
-rw-r--r-- | holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java index 2651c97..5fb1176 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java @@ -61,13 +61,13 @@ public class DmaapService { public PolicyMsg getPolicyMsg(VesAlarm rootAlarm, VesAlarm childAlarm, String packgeName) { return Optional.ofNullable(getVmEntity(rootAlarm.getSourceId(), rootAlarm.getSourceName())) .map(vmEntity -> getEnrichedPolicyMsg(vmEntity, rootAlarm, childAlarm, packgeName)) - .orElse(getDefaultPolicyMsg(rootAlarm.getSourceName())); + .orElse(getDefaultPolicyMsg(rootAlarm, packgeName)); } private PolicyMsg getEnrichedPolicyMsg(VmEntity vmEntity, VesAlarm rootAlarm, VesAlarm childAlarm, String packageName) { PolicyMsg policyMsg = new PolicyMsg(); - policyMsg.setRequestID(getUniqueRequestId(rootAlarm, policyMsg)); + policyMsg.setRequestID(getUniqueRequestId(rootAlarm)); if (rootAlarm.getAlarmIsCleared() == PolicyMassgeConstant.POLICY_MESSAGE_ONSET) { enrichVnfInfo(vmEntity, childAlarm, policyMsg); policyMsg.setClosedLoopEventStatus(EVENT_STATUS.ONSET); @@ -95,15 +95,22 @@ public class DmaapService { return policyMsg; } - private PolicyMsg getDefaultPolicyMsg(String sourceName) { + private PolicyMsg getDefaultPolicyMsg(VesAlarm rootAlarm, String packageName) { PolicyMsg policyMsg = new PolicyMsg(); - policyMsg.setTarget("vserver.vserver-id"); + policyMsg.setRequestID(getUniqueRequestId(rootAlarm)); + policyMsg.setClosedLoopControlName(loopControlNames.get(packageName)); + policyMsg.setClosedLoopAlarmStart(rootAlarm.getStartEpochMicrosec()); + policyMsg.setTarget("vserver.vserver-name"); policyMsg.setTargetType("VM"); - policyMsg.getAai().put("vserver.vserver-name", sourceName); + policyMsg.getAai().put("vserver.vserver-name", rootAlarm.getSourceName()); + if (rootAlarm.getAlarmIsCleared() == PolicyMassgeConstant.POLICY_MESSAGE_ABATED) { + policyMsg.setClosedLoopAlarmEnd(rootAlarm.getLastEpochMicrosec()); + policyMsg.setClosedLoopEventStatus(EVENT_STATUS.ABATED); + } return policyMsg; } - private String getUniqueRequestId(VesAlarm rootAlarm, PolicyMsg policyMsg) { + private String getUniqueRequestId(VesAlarm rootAlarm) { String alarmUniqueKey = ""; if (rootAlarm.getAlarmIsCleared() == PolicyMassgeConstant.POLICY_MESSAGE_ABATED) { alarmUniqueKey = |