From 8c8fe4253f4cb61216bbc2564928a79a3723e703 Mon Sep 17 00:00:00 2001 From: yashwanth Date: Fri, 3 Sep 2021 05:07:02 +0000 Subject: Update FM message spec to VES 7.2 Issue-ID: DCAEGEN2-2884 Signed-off-by: yashwanth Change-Id: Id6b9eef744ae7d2287afa33cdaa28f86d8c06998 --- .../ransim/rest/api/handler/RansimPciHandler.java | 104 +++++++++++---------- .../onap/ransim/rest/api/models/FmAlarmInfo.java | 51 +++++----- .../onap/ransim/websocket/model/FaultFields.java | 43 +++++---- .../rest/api/controller/TestRansimController.java | 10 +- 4 files changed, 117 insertions(+), 91 deletions(-) diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java index 881d19b..6ba89c2 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Ran Simulator Controller * ================================================================================ - * Copyright (C) 2020 Wipro Limited. + * Copyright (C) 2020-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. @@ -95,34 +95,37 @@ public class RansimPciHandler { boolean collisionDetected = false; boolean confusionDetected = false; List nbrPcis = new ArrayList(); - List ConfusionPcis = new ArrayList(); - int collisionCount = 0; - int confusionCount = 0; + String collisions = ""; + HashMap confusions = new HashMap(); CellDetails currentCell = ransimRepo.getCellDetail(cellNodeId); log.info("Setting confusion/collision for Cell :" + cellNodeId); GetNeighborList cellNbrDetails = generateNeighborList(cellNodeId); for (CellDetails firstLevelNbr : cellNbrDetails.getCellsWithHo()) { - if (nbrPcis.contains((Long) firstLevelNbr.getPhysicalCellId())) { + if (nbrPcis.contains((Long) firstLevelNbr.getPhysicalCellId())) { confusionDetected = true; - if (ConfusionPcis.contains(firstLevelNbr.getPhysicalCellId())) { - confusionCount++; + if(confusions.containsKey((Long) firstLevelNbr.getPhysicalCellId())) { + confusions.put((Long) firstLevelNbr.getPhysicalCellId(), + confusions.get((Long) firstLevelNbr.getPhysicalCellId())+","+firstLevelNbr.getNodeId()); } else { - ConfusionPcis.add(firstLevelNbr.getPhysicalCellId()); - confusionCount = confusionCount + 2; + confusions.put((Long) firstLevelNbr.getPhysicalCellId(),firstLevelNbr.getNodeId()); } - } else { - nbrPcis.add((Long) firstLevelNbr.getPhysicalCellId()); - } - if (currentCell.getPhysicalCellId() == firstLevelNbr.getPhysicalCellId()) { - collisionDetected = true; - collisionCount++; - } + } else { + nbrPcis.add((Long) firstLevelNbr.getPhysicalCellId()); + } + + if (currentCell.getPhysicalCellId() == firstLevelNbr.getPhysicalCellId()) { + collisionDetected = true; + collisions += collisions.isEmpty()?firstLevelNbr.getNodeId():","+firstLevelNbr.getNodeId(); + } } + result.setCollisions(collisions); + result.setConfusions(confusions); + currentCell.setPciCollisionDetected(collisionDetected); currentCell.setPciConfusionDetected(confusionDetected); @@ -147,9 +150,6 @@ public class RansimPciHandler { result.setProblem("No Issues"); } - result.setCollisionCount("" + collisionCount); - result.setConfusionCount("" + confusionCount); - ransimRepo.mergeCellDetails(currentCell); return result; @@ -731,54 +731,60 @@ public class RansimPciHandler { * Node Id of the cell * @param issue * Contains the collision/confusion details of the cess - * @return returns EventFm object, with all the necessary parameters. + * @return returns List of EventFm objects, with all the necessary parameters. */ - public static EventFm setEventFm(String networkId, String ncServer, String cellId, FmAlarmInfo issue) { + public static List setEventFm(String networkId, String ncServer, String cellId, FmAlarmInfo issue) { log.info("Inside generate FmData"); + List eventList = new ArrayList(); EventFm event = new EventFm(); try { CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); FaultFields faultFields = new FaultFields(); - - commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); - commonEventHeader.setSourceName(cellId); - commonEventHeader.setReportingEntityName(ncServer); - String uuid = globalFmCellIdUuidMap.get(cellId); if (uuid == null) { uuid = getUuid(); globalFmCellIdUuidMap.put(cellId, uuid); } commonEventHeader.setSourceUuid(uuid); - - if (issue.getProblem().equals("Collision") || issue.getProblem().equals("Confusion") - || issue.getProblem().equals("CollisionAndConfusion")) { - faultFields.setAlarmCondition("RanPciCollisionConfusionOccurred"); - faultFields.setEventSeverity("CRITICAL"); - faultFields.setEventSourceType("other"); - faultFields.setSpecificProblem(issue.getProblem()); - - Map alarmAdditionalInformation = new HashMap(); - alarmAdditionalInformation.put("networkId", networkId); - alarmAdditionalInformation.put("collisions", issue.getCollisionCount()); - alarmAdditionalInformation.put("confusions", issue.getConfusionCount()); - - faultFields.setAlarmAdditionalInformation(alarmAdditionalInformation); - + faultFields.setAlarmCondition("RanPciCollisionConfusionOccurred"); + faultFields.setEventSeverity("CRITICAL"); + faultFields.setEventSourceType("other"); + Map alarmAdditionalInformation = new HashMap(); + alarmAdditionalInformation.put("networkId", networkId); + faultFields.setAlarmAdditionalInformation(alarmAdditionalInformation); + + if (!issue.getCollisions().isEmpty()) { + commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + commonEventHeader.setSourceName(cellId); + commonEventHeader.setReportingEntityName(ncServer); + faultFields.setSpecificProblem(issue.getCollisions()); + faultFields.setEventCategory("PCICollision"); + commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + event.setCommonEventHeader(commonEventHeader); + event.setFaultFields(faultFields); + eventList.add(event); } - commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); - event.setCommonEventHeader(commonEventHeader); - event.setFaultFields(faultFields); + for (Map.Entry set : issue.getConfusions().entrySet()) { + commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + commonEventHeader.setSourceName(cellId); + commonEventHeader.setReportingEntityName(ncServer); + faultFields.setSpecificProblem(set.getValue()); + faultFields.setEventCategory("PCIConfusion"); + commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + event.setCommonEventHeader(commonEventHeader); + event.setFaultFields(faultFields); + eventList.add(event); + } } catch (Exception e) { log.info("Exception: ", e); } - return event; + return eventList; } @@ -806,8 +812,8 @@ public class RansimPciHandler { if (op1.getProblem().equals("CollisionAndConfusion") || op1.getProblem().equals("Collision") || op1.getProblem().equals("Confusion")) { log.info("op1: " + op1); - EventFm lci = setEventFm(cell.getNetworkId(), cell.getServerId(), cell.getNodeId(), op1); - listCellIssue.add(lci); + List lci = setEventFm(cell.getNetworkId(), cell.getServerId(), cell.getNodeId(), op1); + listCellIssue.addAll(lci); ncs.add(cell.getServerId()); log.info("Generating Fm data for: " + cell.getNodeId()); } @@ -820,9 +826,9 @@ public class RansimPciHandler { if (source.equals("GUI")) { if (op2.getProblem().equals("CollisionAndConfusion") || op2.getProblem().equals("Collision") || op2.getProblem().equals("Confusion")) { - EventFm lci = setEventFm(nbrCell.getNetworkId(), nbrCell.getServerId(), nbrCell.getNodeId(), op2); + List lci = setEventFm(nbrCell.getNetworkId(), nbrCell.getServerId(), nbrCell.getNodeId(), op2); log.info("FmData added:" + nbrCell.getNodeId()); - listCellIssue.add(lci); + listCellIssue.addAll(lci); ncs.add(nbrCell.getServerId()); log.info("Generating Fm data for: " + nbrCell.getNodeId()); } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java index 2b7dd39..ef81d3b 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Ran Simulator Controller * ================================================================================ - * Copyright (C) 2020 Wipro Limited. + * Copyright (C) 2020-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. @@ -20,52 +20,59 @@ package org.onap.ransim.rest.api.models; -public class FmAlarmInfo { +import java.util.HashMap; +public class FmAlarmInfo { + private String problem; - private String collisionCount; - private String confusionCount; + private String collisions; + private HashMap confusions; + public FmAlarmInfo() { super(); } - + /** * Constructor with all fields. - * - * @param problem Collision or Confusion - * @param collisionCount No of cells that causes collision. - * @param confusionCount No od cells that causes confusion. + * + * @param problem + * Collision or Confusion + * @param collisions + * Cell ids that causes collision. + * @param confusions + * Cell ids that causes confusion. */ - public FmAlarmInfo(String problem, String collisionCount, String confusionCount) { + public FmAlarmInfo(String problem, String collisions, HashMap confusions) { super(); this.problem = problem; - this.collisionCount = collisionCount; - this.confusionCount = confusionCount; + this.collisions = collisions; + this.confusions = confusions; } - + public String getProblem() { return problem; } - + public void setProblem(String problem) { this.problem = problem; } - public String getCollisionCount() { - return collisionCount; + public String getCollisions() { + return collisions; } - public void setCollisionCount(String collisionCount) { - this.collisionCount = collisionCount; + public void setCollisions(String collisions) { + this.collisions = collisions; } - public String getConfusionCount() { - return confusionCount; + public HashMap getConfusions(){ + return confusions; } - public void setConfusionCount(String confusionCount) { - this.confusionCount = confusionCount; + public void setConfusions(HashMap confusions) { + this.confusions = confusions; } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java index 17fed3c..38c24c9 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Ran Simulator Controller * ================================================================================ - * Copyright (C) 2020 Wipro Limited. + * Copyright (C) 2020-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. @@ -23,65 +23,76 @@ package org.onap.ransim.websocket.model; import java.util.Map; public class FaultFields { - + private String alarmCondition; private String eventSourceType; private String specificProblem; private String eventSeverity; + private String eventCategory; private Map alarmAdditionalInformation; - + public FaultFields() { super(); + // TODO Auto-generated constructor stub } - - public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, String eventSeverity, - Map alarmAdditionalInformation) { + + public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, + String eventSeverity, String eventCategory, Map alarmAdditionalInformation) { super(); this.alarmCondition = alarmCondition; this.eventSourceType = eventSourceType; this.specificProblem = specificProblem; this.eventSeverity = eventSeverity; + this.eventCategory = eventCategory; this.alarmAdditionalInformation = alarmAdditionalInformation; } - + public String getAlarmCondition() { return alarmCondition; } - + public void setAlarmCondition(String alarmCondition) { this.alarmCondition = alarmCondition; } - + public String getEventSourceType() { return eventSourceType; } - + public void setEventSourceType(String eventSourceType) { this.eventSourceType = eventSourceType; } - + public String getSpecificProblem() { return specificProblem; } - + public void setSpecificProblem(String specificProblem) { this.specificProblem = specificProblem; } - + public String getEventSeverity() { return eventSeverity; } - + public void setEventSeverity(String eventSeverity) { this.eventSeverity = eventSeverity; } + public String getEventCategory(){ + return eventCategory; + } + + public void setEventCategory(String eventCategory) { + this.eventCategory = eventCategory; + } + public Map getAlarmAdditionalInformation() { return alarmAdditionalInformation; } - + public void setAlarmAdditionalInformation(Map alarmAdditionalInformation) { this.alarmAdditionalInformation = alarmAdditionalInformation; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java index 4c886e3..400089f 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java @@ -187,11 +187,9 @@ public class TestRansimController { RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); Map alarmAdditionalInformation = new HashMap(); alarmAdditionalInformation.put("networkId", "abc"); - alarmAdditionalInformation.put("collisions", "1"); - alarmAdditionalInformation.put("confusions", "0"); CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm("Chn00", "", "nc1", 0, 0); FaultFields faultFields = new FaultFields("RanPciCollisionConfusionOccurred", "other", "Collision", "CRITICAL", - alarmAdditionalInformation); + "PCICollision", alarmAdditionalInformation); EventFm checkObj = new EventFm(commonEventHeader, faultFields); new MockUp() { @@ -210,7 +208,11 @@ public class TestRansimController { String networkId = "abc"; String ncServer = "nc1"; String cellId = "Chn00"; - FmAlarmInfo issue = new FmAlarmInfo("Collision", "1", "0"); + String collisions = ""; + HashMap confusions = new HashMap(); + collisions += "Chn00"+","+"Chn00"; + confusions.put(Long.valueOf(0),"Chn00");confusions.put(Long.valueOf(1),"Chn00"); + FmAlarmInfo issue = new FmAlarmInfo("Collision", collisions, confusions); /* * EventFm eventObj = rscontroller.setEventFm(networkId, ncServer, cellId, * issue); -- cgit 1.2.3-korg