Process fault clearance notification from RANSIM 25/100525/1
authorniranjana <niranjana.y60@wipro.com>
Tue, 21 Jan 2020 05:21:00 +0000 (10:51 +0530)
committerniranjana <niranjana.y60@wipro.com>
Tue, 21 Jan 2020 05:21:00 +0000 (10:51 +0530)
Issue-ID: DCAEGEN2-2033

Signed-off-by: niranjana <niranjana.y60@wipro.com>
Change-Id: I7a84dadd8bde8f403a498c4017d633148bf575c9

src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java

index 43c8e3d..2f30a91 100644 (file)
@@ -145,38 +145,50 @@ public class MainThread implements Runnable {
 
                 }
                 if (newFmNotification.getNewNotif()) {
-                    log.info("newFmNotification has come");
-
-                    String faultCellId = "";
-                    Either<List<FaultEvent>, 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<List<FaultEvent>, 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);