Update FM message spec to VES 7.2 12/123212/7
authorYashwanth <gandhapu.yashwanth@wipro.com>
Tue, 10 Aug 2021 04:42:33 +0000 (04:42 +0000)
committerYashwanth <gandhapu.yashwanth@wipro.com>
Tue, 24 Aug 2021 05:17:23 +0000 (05:17 +0000)
Issue-ID: DCAEGEN2-2884

Signed-off-by: Yashwanth <gandhapu.yashwanth@wipro.com>
Change-Id: I8f609af56604fae86b8a75aaadce14c78ba8ffb8

Changelog.md
src/main/java/org/onap/dcaegen2/services/sonhms/EventHandler.java
src/main/java/org/onap/dcaegen2/services/sonhms/FaultFields.java
src/test/resources/faultNotification.json

index 7387c84..9f695ba 100644 (file)
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
 ## [2.1.4] - 21/06/2021
          - [DCAEGEN2-2711](https://jira.onap.org/browse/DCAEGEN2-2711) - Update sdk version to load policies from a file mounted by policy sidecar container
          - [DCAEGEN2-2809](https://jira.onap.org/browse/DCAEGEN2-2809) - Remove security vulnerabilities
+         - [DCAEGEN2-2884](https://jira.onap.org/browse/DCAEGEN2-2884) - Update FM message spec to VES 7.2
 
 ## [2.1.3] - 03/02/2021
          - [DCAEGEN2-2599](https://jira.onap.org/browse/DCAEGEN2-2599) - Remove security vulnerabilities
index c96cbc8..325de6f 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  son-handler
  *  ================================================================================
- *   Copyright (C) 2019 Wipro Limited.
+ *   Copyright (C) 2019-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -86,25 +86,25 @@ public class EventHandler {
 
         log.info("Handling Fault notification");
         log.info("fm notification {}", fmNotification);
-        
+
         Set<String> cellIds = new HashSet<>();
         List<ClusterDetails> clusterDetails = clusterUtils.getAllClusters();
         String networkId = "";
         Map<String, ArrayList<Integer>> collisionConfusionMap = new HashMap<>();
-
         for (FaultEvent faultEvent : fmNotification) {
             String cellId = faultEvent.getEvent().getCommonEventHeader().getSourceName();
             cellIds.add(cellId);
             networkId = faultEvent.getEvent().getFaultFields().getAlarmAdditionalInformation().getNetworkId();
+
             ArrayList<Integer> counts = new ArrayList<>();
-            counts.add(faultEvent.getEvent().getFaultFields().getAlarmAdditionalInformation().getCollisions());
-            counts.add(faultEvent.getEvent().getFaultFields().getAlarmAdditionalInformation().getConfusions());
+            counts.add(faultEvent.getEvent().getFaultFields().getEventCategory().contains("Collision")?1:0);
+            counts.add(faultEvent.getEvent().getFaultFields().getEventCategory().contains("Confusion")?1:0);
             collisionConfusionMap.put(cellId, counts);
         }
         FaultNotificationtoClusterMapping faultNotificationtoClusterMapping = clusterUtils
                 .getClustersForFmNotification(cellIds, clusterDetails);
-
         faultNotificationtoClusterMapping.setCollisionConfusionMap(collisionConfusionMap);
+
         // matching cells
         if (faultNotificationtoClusterMapping.getCellsinCluster() != null 
                 && !faultNotificationtoClusterMapping.getCellsinCluster().isEmpty()) {
@@ -113,13 +113,11 @@ public class EventHandler {
             } catch (ConfigDbNotFoundException e) {
                 log.error("Config DB Exception {}", e);
             }
-
         }
         // unmatched new cells
         if (faultNotificationtoClusterMapping.getNewCells() != null 
                 && !faultNotificationtoClusterMapping.getNewCells().isEmpty()) {
-            handleUnmatchedFmCells(faultNotificationtoClusterMapping, networkId);
-
+           handleUnmatchedFmCells(faultNotificationtoClusterMapping, networkId);
         }
 
         return true;
index e95d38e..0501fb0 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  son-handler
  *  ================================================================================
- *   Copyright (C) 2019 Wipro Limited.
+ *   Copyright (C) 2019-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ public class FaultFields {
     @Override
     public String toString() {
         return "FaultFields [faultFieldsVersion=" + faultFieldsVersion + ", alarmCondition=" + alarmCondition
-                + ", eventSourceType=" + eventSourceType + ", specificProblem=" + specificProblem + ", eventSeverity="
+                + ", eventSourceType=" + eventSourceType + ", eventCategory=" + eventCategory  + ", specificProblem=" + specificProblem + ", eventSeverity="
                 + eventSeverity + ", vfStatus=" + vfStatus + ", alarmAdditionalInformation="
                 + alarmAdditionalInformation + "]";
     }
@@ -37,6 +37,7 @@ public class FaultFields {
     private double faultFieldsVersion;
     private String alarmCondition;
     private String eventSourceType;
+    private String eventCategory;
     private String specificProblem;
     private String eventSeverity;
     private String vfStatus;
@@ -74,6 +75,14 @@ public class FaultFields {
         this.eventSourceType = eventSourceType;
     }
 
+    public String getEventCategory() {
+        return eventCategory;
+    }
+
+    public void setEventCategory(String eventCategory) {
+        this.eventCategory = eventCategory;
+    }
+    
     public String getSpecificProblem() {
         return specificProblem;
     }
index 803302a..0df4974 100644 (file)
@@ -2,7 +2,7 @@
       "event":{
          "commonEventHeader":{
             "version":"4.0.1",
-            "vesEventListenerVersion":"7.0.1",
+            "vesEventListenerVersion":"7.2",
             "domain":"fault",
             "eventName":"Fault_RansimAgent-Wipro_RanPCIProblem",
             "eventId":"fault000001",
             "faultFieldsVersion":"4.0",
             "alarmCondition":"RanPciCollisionConfusionOccurred",
             "eventSourceType":"other",
-            "specificProblem":"Collision",
+            "specificProblem":"Chn0025",
             "eventSeverity":"CRITICAL",
+            "eventCategory": "PCICollision",
             "vfStatus":"Active",
             "alarmAdditionalInformation":{
-               "networkId":"NTWK005",
-               "collisions":"2",
-               "confusions":"0"
+               "networkId":"NTWK005"
             }
          }
       }