From e05d755dfb068c5d88a0b6d5cf44b3db60afe573 Mon Sep 17 00:00:00 2001 From: niranjana Date: Tue, 21 Jan 2020 10:51:00 +0530 Subject: Process fault clearance notification from RANSIM Issue-ID: DCAEGEN2-2033 Signed-off-by: niranjana Change-Id: I7a84dadd8bde8f403a498c4017d633148bf575c9 --- .../onap/dcaegen2/services/sonhms/MainThread.java | 76 +++++++++++++--------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java b/src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java index 43c8e3d..2f30a91 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java @@ -145,38 +145,50 @@ public class MainThread implements Runnable { } if (newFmNotification.getNewNotif()) { - log.info("newFmNotification has come"); - - String faultCellId = ""; - Either, Integer> fmNotifications = faultNotificationComponent - .getFaultNotifications(); - if (fmNotifications.isRight()) { - if (fmNotifications.right().value() == 400) { - log.info("Error parsing notifications"); - } else if (fmNotifications.right().value() == 404) { - newFmNotification.setNewNotif(false); - } - } else { - for (FaultEvent fmNotification : fmNotifications.left().value()) { - faultCellId = fmNotification.getEvent().getCommonEventHeader().getSourceName(); - bufferedFmNotificationCells.put(faultCellId, fmNotification); - log.info("Buffered FM cell {}", faultCellId); - log.info("fmNotification{}", fmNotification); - - } - log.info("bufferedFMNotificationCells before staring timer {}", - bufferedFmNotificationCells.keySet()); - - for (String sdnrCell : sdnrNotificationCells) { - bufferedFmNotificationCells.remove(sdnrCell); - } - - startTimer = new Timestamp(System.currentTimeMillis()); - isTimer = true; - log.info("Buffered FM cell {}", bufferedFmNotificationCells.keySet()); - } - - } + log.info("newFmNotification has come"); + + String faultCellId = ""; + Either, Integer> fmNotifications = faultNotificationComponent + .getFaultNotifications(); + if (fmNotifications.isRight()) { + if (fmNotifications.right().value() == 400) { + log.info("Error parsing notifications"); + } else if (fmNotifications.right().value() == 404) { + newFmNotification.setNewNotif(false); + } + } else { + for (FaultEvent fmNotification : fmNotifications.left().value()) { + if (fmNotification.getEvent().getFaultFields().getSpecificProblem() + .equals("Optimised PCI")) { + log.info("PCI problem cleared for :" + fmNotification); + } else if ((fmNotification.getEvent().getFaultFields().getSpecificProblem() + .equals("Collision")) + || (fmNotification.getEvent().getFaultFields().getSpecificProblem() + .equals("Confusion"))) { + faultCellId = fmNotification.getEvent().getCommonEventHeader().getSourceName(); + bufferedFmNotificationCells.put(faultCellId, fmNotification); + log.info("Buffered FM cell {}", faultCellId); + log.info("fmNotification{}", fmNotification); + } else { + log.info("Error resolving faultNotification for :" + fmNotification); + } + } + + if (!(bufferedFmNotificationCells.isEmpty())) { + log.info("bufferedFMNotificationCells before staring timer {}", + bufferedFmNotificationCells.keySet()); + + for (String sdnrCell : sdnrNotificationCells) { + bufferedFmNotificationCells.remove(sdnrCell); + } + + startTimer = new Timestamp(System.currentTimeMillis()); + isTimer = true; + log.info("Buffered FM cell {}", bufferedFmNotificationCells.keySet()); + } + } + + } } catch (Exception e) { log.error("Exception in main Thread", e); -- cgit 1.2.3-korg