diff options
Diffstat (limited to 'ransim/ransimctrlr')
13 files changed, 329 insertions, 141 deletions
diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java index 93b4f5c..c518109 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java @@ -54,6 +54,9 @@ import org.onap.ransim.rest.api.models.ModifyACellReq; import org.onap.ransim.rest.api.models.NeighborDetails; import org.onap.ransim.rest.api.models.NeihborId; import org.onap.ransim.rest.api.models.NetconfServers; +import org.onap.ransim.rest.api.models.NRCellCU; +import org.onap.ransim.rest.api.models.NRCellDU; +import org.onap.ransim.rest.api.models.NRCellRelation; import org.onap.ransim.rest.api.models.OperationLog; import org.onap.ransim.rest.api.models.TACells; import org.onap.ransim.rest.api.models.Topology; @@ -149,6 +152,7 @@ public class RansimController { rscServices.loadGNBFunctionProperties(); long startTimeStartSimulation = System.currentTimeMillis(); rscServices.sendRanInitialConfigAll(); + rscServices.generateCluster(); long endTimeStartSimulation = System.currentTimeMillis(); log.info("Time taken for start ran slice simulation : " + (endTimeStartSimulation - startTimeStartSimulation)); @@ -268,7 +272,22 @@ public class RansimController { log.debug("Inside getTopology..."); try { rsPciHdlr.checkCollisionAfterModify(); - List<CellDetails> cds = ransimRepo.getCellDetailsList(); + List<NRCellCU> celldata = ransimRepo.getCUCellDetailsList(); + List<CellDetails> cds = new ArrayList<CellDetails>(); + for(int i = 0; i < celldata.size(); i++){ + NRCellDU ducell = ransimRepo.getNRCellDUDetail(celldata.get(i).getCellLocalId()); + CellDetails cell = new CellDetails(); + cell.setScreenX(celldata.get(i).getScreenX()); + cell.setScreenY(celldata.get(i).getScreenY()); + cell.setPciConfusionDetected(celldata.get(i).isPciConfusionDetected()); + cell.setPciCollisionDetected(celldata.get(i).isPciCollisionDetected()); + cell.setColor(celldata.get(i).getColor()); + cell.setNodeName(celldata.get(i).getCellLocalId().toString()); + cell.setServerId(celldata.get(i).getgNBCUCPFunction().getgNBCUName()); + cell.setPhysicalCellId(ducell.getnRPCI()); + cell.setNetworkId(ducell.getNetworkId()); + cds.add(cell); + } Topology top = new Topology(); @@ -299,6 +318,7 @@ public class RansimController { Gson gson = new Gson(); String jsonStr = gson.toJson(top); + log.info("jsonStr is" + jsonStr); return new ResponseEntity<>(jsonStr, HttpStatus.OK); @@ -451,11 +471,13 @@ public class RansimController { nbrsStr = ""; } String source = "GUI"; - List<NeighborDetails> nbrsList = new ArrayList<NeighborDetails>(); + NRCellCU nrCellCU = ransimRepo.getNRCellCUDetail(Integer.valueOf(req.getNodeId())); + List<NRCellRelation> nbrsList = new ArrayList<NRCellRelation>(); String[] newNbrsArr = nbrsStr.split(","); for (int i = 0; i < newNbrsArr.length; i++) { - NeighborDetails cell = new NeighborDetails(new NeihborId(req.getNodeId(), newNbrsArr[i].trim()), false); + NRCellRelation cell = new NRCellRelation(Integer.valueOf(newNbrsArr[i].trim()), + Integer.valueOf(newNbrsArr[i].trim()),true,nrCellCU); nbrsList.add(cell); } 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 1b57776..41ecbdf 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 @@ -45,6 +45,7 @@ import org.onap.ransim.rest.api.models.GetNeighborList; import org.onap.ransim.rest.api.models.NeighborDetails; import org.onap.ransim.rest.api.models.NetconfServers; import org.onap.ransim.rest.api.models.NRCellCU; +import org.onap.ransim.rest.api.models.NRCellDU; import org.onap.ransim.rest.api.models.NRCellRelation; import org.onap.ransim.rest.api.models.OperationLog; import org.onap.ransim.rest.api.models.PmDataDump; @@ -88,7 +89,7 @@ public class RansimPciHandler { List<PmParameters> pmParameters = new ArrayList<PmParameters>(); int next = 0; - public FmAlarmInfo setCollisionConfusionFromFile(String cellNodeId) { + public FmAlarmInfo setCollisionConfusionFromFile(Integer cellNodeId) { FmAlarmInfo result = new FmAlarmInfo(); @@ -96,32 +97,33 @@ public class RansimPciHandler { boolean collisionDetected = false; boolean confusionDetected = false; - List<Long> nbrPcis = new ArrayList<Long>(); + List<Integer> nbrPcis = new ArrayList<Integer>(); String collisions = ""; - HashMap<Long, String> confusions = new HashMap<Long, String>(); - CellDetails currentCell = ransimRepo.getCellDetail(cellNodeId); + HashMap<Integer, Integer> confusions = new HashMap<Integer, Integer>(); + NRCellCU currentCell = ransimRepo.getNRCellCUDetail(cellNodeId); + Integer currentCellNRPCI = ransimRepo.getNRPCI(cellNodeId); log.info("Setting confusion/collision for Cell :" + cellNodeId); - GetNeighborList cellNbrDetails = generateNeighborList(cellNodeId); + GetNeighborList cellNbrDetails = generateNeighborList(cellNodeId.toString()); - for (CellDetails firstLevelNbr : cellNbrDetails.getCellsWithHo()) { - if (nbrPcis.contains((Long) firstLevelNbr.getPhysicalCellId())) { + for (NRCellCU firstLevelNbr : cellNbrDetails.getCUCellsWithHo()) { + Integer cellId = firstLevelNbr.getCellLocalId(); + Integer nRPCI = ransimRepo.getNRPCI(cellId); + if (nbrPcis.contains(nRPCI)) { confusionDetected = true; - if(confusions.containsKey((Long) firstLevelNbr.getPhysicalCellId())) { - confusions.put((Long) firstLevelNbr.getPhysicalCellId(), - confusions.get((Long) firstLevelNbr.getPhysicalCellId())+","+firstLevelNbr.getNodeId()); + if(confusions.containsKey((nRPCI))) { + confusions.put(nRPCI,confusions.get(nRPCI+","+firstLevelNbr.getCellLocalId())); } else { - confusions.put((Long) firstLevelNbr.getPhysicalCellId(),firstLevelNbr.getNodeId()); - } - + confusions.put(nRPCI,firstLevelNbr.getCellLocalId()); + } } else { - nbrPcis.add((Long) firstLevelNbr.getPhysicalCellId()); + nbrPcis.add(nRPCI); } - if (currentCell.getPhysicalCellId() == firstLevelNbr.getPhysicalCellId()) { + if (currentCellNRPCI == nRPCI) { collisionDetected = true; - collisions += collisions.isEmpty()?firstLevelNbr.getNodeId():","+firstLevelNbr.getNodeId(); + collisions += collisions.isEmpty()?firstLevelNbr.getCellLocalId():","+firstLevelNbr.getCellLocalId(); } } @@ -152,7 +154,7 @@ public class RansimPciHandler { result.setProblem("No Issues"); } - ransimRepo.mergeCellDetails(currentCell); + ransimRepo.mergeNRCellCU(currentCell); return result; @@ -210,11 +212,11 @@ public class RansimPciHandler { public void checkCollisionAfterModify() { try { - List<CellDetails> checkCollisionConfusion = ransimRepo.getCellsWithCollisionOrConfusion(); + List<NRCellCU> checkCollisionConfusion = ransimRepo.getCellsWithCollisionOrConfusion(); for (int i = 0; i < checkCollisionConfusion.size(); i++) { - log.info(checkCollisionConfusion.get(i).getNodeId()); - setCollisionConfusionFromFile(checkCollisionConfusion.get(i).getNodeId()); + log.info(checkCollisionConfusion.get(i).getCellLocalId()); + setCollisionConfusionFromFile(Integer.valueOf(checkCollisionConfusion.get(i).getCellLocalId())); } } catch (Exception eu) { log.info("checkCollisionAfterModify", eu); @@ -235,99 +237,98 @@ public class RansimPciHandler { * The source from which cell modification has been triggered * @return returns success or failure message */ - public int modifyCellFunction(String nodeId, long physicalCellId, List<NeighborDetails> newNbrs, String source) { + public int modifyCellFunction(String nodeId, Integer physicalCellId, List<NRCellRelation> newNbrs, String source) { int result = 111; log.info("modifyCellFunction nodeId:" + nodeId + ", physicalCellId:" + physicalCellId); - CellDetails modifyCell = ransimRepo.getCellDetail(nodeId); + NRCellCU modifyCell = ransimRepo.getNRCellCUDetail(Integer.valueOf(nodeId)); if (modifyCell != null) { if (physicalCellId < 0 || physicalCellId > RansimControllerServices.maxPciValueAllowed) { log.info("NewPhysicalCellId is empty or invalid"); result = 400; } else { - long oldPciId = modifyCell.getPhysicalCellId(); + long oldPciId = ransimRepo.getNRPCI(modifyCell.getCellLocalId()); if (physicalCellId != oldPciId) { updatePciOperationsTable(nodeId, source, physicalCellId, oldPciId); - - modifyCell.setPhysicalCellId(physicalCellId); - ransimRepo.mergeCellDetails(modifyCell); + NRCellDU nrCellDU = ransimRepo.getNRCellDUDetail(modifyCell.getCellLocalId()); + nrCellDU.setnRPCI(physicalCellId); + ransimRepo.mergeNRCellDU(nrCellDU); } - CellNeighbor neighbors = ransimRepo.getCellNeighbor(nodeId); - List<NeighborDetails> oldNbrList = new ArrayList<NeighborDetails>(neighbors.getNeighborList()); - List<NeighborDetails> oldNbrListWithHo = new ArrayList<NeighborDetails>(); + NRCellCU neighbors = ransimRepo.getNRCellCUDetail(Integer.valueOf(nodeId)); + List<NRCellRelation> oldNbrList = new ArrayList<NRCellRelation>(neighbors.getNrCellRelationsList()); + List<NRCellRelation> oldNbrListWithHo = new ArrayList<NRCellRelation>(); - for (NeighborDetails cell : oldNbrList) { - if (!cell.isBlacklisted()) { - oldNbrListWithHo.add(cell); - } - } + for (NRCellRelation cell : oldNbrList) { + if (cell.getisHOAllowed()) { + oldNbrListWithHo.add(cell); + } + } boolean flag = false; - List<NeighborDetails> addedNbrs = new ArrayList<NeighborDetails>(); - List<NeighborDetails> deletedNbrs = new ArrayList<NeighborDetails>(); - - String nbrsDel = ""; - - List<String> oldNbrsArr = new ArrayList<String>(); - for (NeighborDetails cell : oldNbrListWithHo) { - oldNbrsArr.add(cell.getNeigbor().getNeighborCell()); - } + List<NRCellRelation> addedNbrs = new ArrayList<NRCellRelation>(); + List<NRCellRelation> deletedNbrs = new ArrayList<NRCellRelation>(); - List<String> newNbrsArr = new ArrayList<String>(); - for (NeighborDetails cell : newNbrs) { - newNbrsArr.add(cell.getNeigbor().getNeighborCell()); - } + String nbrsDel = ""; - for (NeighborDetails cell : oldNbrListWithHo) { + List<String> oldNbrsArr = new ArrayList<String>(); + for (NRCellRelation cell : oldNbrListWithHo) { + oldNbrsArr.add(cell.getIdNRCellRelation().toString()); + } - if (!newNbrsArr.contains(cell.getNeigbor().getNeighborCell())) { + List<String> newNbrsArr = new ArrayList<String>(); + for (NRCellRelation cell : newNbrs) { + newNbrsArr.add(cell.getIdNRCellRelation().toString()); + } + + for (NRCellRelation cell : oldNbrListWithHo) { + if (!newNbrsArr.contains(cell.getIdNRCellRelation())) { if (!flag) { flag = true; } deletedNbrs.add(cell); if (nbrsDel == "") { - nbrsDel = cell.getNeigbor().getNeighborCell(); + nbrsDel = String.valueOf(cell.getIdNRCellRelation()); } else { - nbrsDel += "," + cell.getNeigbor().getNeighborCell(); + nbrsDel += "," + cell.getIdNRCellRelation(); } - log.info("deleted cell: " + cell.getNeigbor().getNeighborCell() + cell.isBlacklisted()); + log.info("deleted cell: " + cell.getIdNRCellRelation() + cell.getisHOAllowed()); } } String nbrsAdd = ""; - for (NeighborDetails cell : newNbrs) { - if (cell.isBlacklisted()) { + for (NRCellRelation cell : newNbrs) { + if (!cell.getisHOAllowed()) { addedNbrs.add(cell); } else { - if (!oldNbrsArr.contains(cell.getNeigbor().getNeighborCell())) { + if (!oldNbrsArr.contains(cell.getIdNRCellRelation())) { addedNbrs.add(cell); if (nbrsAdd == "") { - nbrsAdd = cell.getNeigbor().getNeighborCell(); + nbrsAdd = String.valueOf(cell.getIdNRCellRelation()); } else { - nbrsAdd += "," + cell.getNeigbor().getNeighborCell(); + nbrsAdd += "," + cell.getIdNRCellRelation(); } - log.info("added cell: " + cell.getNeigbor().getNeighborCell() + cell.isBlacklisted()); + log.info("added cell: " + cell.getIdNRCellRelation() + cell.getisHOAllowed()); } } - - } - List<NeighborDetails> newNeighborList = new ArrayList<NeighborDetails>(oldNbrList); - for (NeighborDetails cell : deletedNbrs) { - NeighborDetails removeHo = new NeighborDetails(cell.getNeigbor(), true); - ransimRepo.mergeNeighborDetails(removeHo); - newNeighborList.add(removeHo); } + + List<NRCellRelation> newNeighborList = new ArrayList<NRCellRelation>(oldNbrList); + for (NRCellRelation cell : deletedNbrs) { + NRCellRelation removeHo = new NRCellRelation(cell.getIdNRCellRelation(), cell.getnRTCI(), false, cell.getCellLocalId()); + ransimRepo.mergeNRCellRel(removeHo); + newNeighborList.add(removeHo); + } - for (NeighborDetails cell : addedNbrs) { - ransimRepo.mergeNeighborDetails(cell); - newNeighborList.add(cell); - } + for (NRCellRelation cell : addedNbrs) { + ransimRepo.mergeNRCellRel(cell); + newNeighborList.add(cell); + } if (!flag) { if (newNbrs.size() != oldNbrList.size()) { @@ -340,10 +341,10 @@ public class RansimPciHandler { } if (newNbrs != null) { - neighbors.getNeighborList().clear(); - Set<NeighborDetails> updatedNbrList = new HashSet<NeighborDetails>(newNeighborList); - neighbors.setNeighborList(updatedNbrList); - ransimRepo.mergeCellNeighbor(neighbors); + neighbors.getNrCellRelationsList().clear(); + List<NRCellRelation> updatedNbrList = newNeighborList; + neighbors.setNrCellRelationsList(updatedNbrList); + ransimRepo.mergeNRCellCU(neighbors); } generateFmData(source, modifyCell, newNeighborList); @@ -413,11 +414,11 @@ public class RansimPciHandler { OperationLog operationLog = new OperationLog(); operationLog.setNodeId(nodeId); - operationLog.setFieldName("PCID"); + operationLog.setFieldName("nRPCI"); operationLog.setOperation("Modify"); operationLog.setSource(source); operationLog.setTime(System.currentTimeMillis()); - operationLog.setMessage("PCID value changed from " + oldPciId + " to " + physicalCellId); + operationLog.setMessage("nRPCI value changed from " + oldPciId + " to " + physicalCellId); ransimRepo.mergeOperationLog(operationLog); } @@ -755,7 +756,7 @@ public class RansimPciHandler { faultFields.setEventSeverity("CRITICAL"); faultFields.setEventSourceType("other"); Map<String, String> alarmAdditionalInformation = new HashMap<String, String>(); - alarmAdditionalInformation.put("networkId", networkId); + alarmAdditionalInformation.put("networkId", "10000000"); faultFields.setAlarmAdditionalInformation(alarmAdditionalInformation); if (!issue.getCollisions().isEmpty()) { @@ -770,11 +771,11 @@ public class RansimPciHandler { eventList.add(event); } - for (Map.Entry<Long, String> set : issue.getConfusions().entrySet()) { + for (Map.Entry<Integer, Integer> set : issue.getConfusions().entrySet()) { commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); commonEventHeader.setSourceName(cellId); commonEventHeader.setReportingEntityName(ncServer); - faultFields.setSpecificProblem(set.getValue()); + faultFields.setSpecificProblem(String.valueOf(set.getValue())); faultFields.setEventCategory("PCIConfusion"); commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); event.setCommonEventHeader(commonEventHeader); @@ -803,36 +804,39 @@ public class RansimPciHandler { * @param newNeighborList * Neighbor list of the given cell. */ - public void generateFmData(String source, CellDetails cell, List<NeighborDetails> newNeighborList) { + public void generateFmData(String source, NRCellCU cell, List<NRCellRelation> nRcellRelList) { List<EventFm> listCellIssue = new ArrayList<EventFm>(); Set<String> ncs = new HashSet<>(); log.info("Generating Fm data"); - FmAlarmInfo op1 = setCollisionConfusionFromFile(cell.getNodeId()); + FmAlarmInfo op1 = setCollisionConfusionFromFile(cell.getCellLocalId()); + String networkId = "ran-1"; + log.info("networkId is : " + networkId); if (source.equals("GUI")) { if (op1.getProblem().equals("CollisionAndConfusion") || op1.getProblem().equals("Collision") || op1.getProblem().equals("Confusion")) { log.info("op1: " + op1); - List<EventFm> lci = setEventFm(cell.getNetworkId(), cell.getServerId(), cell.getNodeId(), op1); + List<EventFm> lci = setEventFm(networkId, cell.getgNBCUCPFunction().getgNBCUName(), cell.getCellLocalId().toString(), op1); listCellIssue.addAll(lci); - ncs.add(cell.getServerId()); - log.info("Generating Fm data for: " + cell.getNodeId()); + ncs.add(cell.getgNBCUCPFunction().getgNBCUName()); + log.info("Generating Fm data for: " + cell.getCellLocalId()); } } - for (NeighborDetails cd : newNeighborList) { - FmAlarmInfo op2 = setCollisionConfusionFromFile(cd.getNeigbor().getNeighborCell()); - CellDetails nbrCell = ransimRepo.getCellDetail(cd.getNeigbor().getNeighborCell()); + for (NRCellRelation cd : nRcellRelList) { + FmAlarmInfo op2 = setCollisionConfusionFromFile(cd.getIdNRCellRelation()); + NRCellCU nbrCell = ransimRepo.getNRCellCUDetail(cd.getIdNRCellRelation()); if (source.equals("GUI")) { if (op2.getProblem().equals("CollisionAndConfusion") || op2.getProblem().equals("Collision") || op2.getProblem().equals("Confusion")) { - List<EventFm> lci = setEventFm(nbrCell.getNetworkId(), nbrCell.getServerId(), nbrCell.getNodeId(), op2); - log.info("FmData added:" + nbrCell.getNodeId()); - listCellIssue.addAll(lci); - ncs.add(nbrCell.getServerId()); - log.info("Generating Fm data for: " + nbrCell.getNodeId()); + List<EventFm> lci = setEventFm(networkId, nbrCell.getgNBCUCPFunction().getgNBCUName(), + String.valueOf(nbrCell.getCellLocalId()), op2); + log.info("FmData added:" + nbrCell.getCellLocalId()); + listCellIssue.addAll(lci); + ncs.add(nbrCell.getgNBCUCPFunction().getgNBCUName()); + log.info("Generating Fm data for: " + nbrCell.getCellLocalId()); } } 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 ef81d3b..5b4acba 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 @@ -26,7 +26,7 @@ public class FmAlarmInfo { private String problem; private String collisions; - private HashMap<Long, String> confusions; + private HashMap<Integer, Integer> confusions; public FmAlarmInfo() { @@ -43,7 +43,7 @@ public class FmAlarmInfo { * @param confusions * Cell ids that causes confusion. */ - public FmAlarmInfo(String problem, String collisions, HashMap<Long, String> confusions) { + public FmAlarmInfo(String problem, String collisions, HashMap<Integer, Integer> confusions) { super(); this.problem = problem; this.collisions = collisions; @@ -66,11 +66,11 @@ public class FmAlarmInfo { this.collisions = collisions; } - public HashMap<Long, String> getConfusions(){ + public HashMap<Integer, Integer> getConfusions(){ return confusions; } - public void setConfusions(HashMap<Long, String> confusions) { + public void setConfusions(HashMap<Integer, Integer> confusions) { this.confusions = confusions; } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java index ff715e3..c7921ce 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java @@ -23,7 +23,7 @@ package org.onap.ransim.rest.api.models; public class ModifyACellReq { private String nodeId; - private Long newPhysicalCellId; + private Integer newPhysicalCellId; private String newNbrs; /** @@ -33,7 +33,7 @@ public class ModifyACellReq { * @param newPhysicalCellId new PCI number for the cell * @param newNbrs new neighbor list for the cell */ - public ModifyACellReq(String nodeId, Long newPhysicalCellId, String newNbrs) { + public ModifyACellReq(String nodeId, Integer newPhysicalCellId, String newNbrs) { super(); this.nodeId = nodeId; this.newPhysicalCellId = newPhysicalCellId; @@ -54,11 +54,11 @@ public class ModifyACellReq { this.nodeId = nodeId; } - public Long getNewPhysicalCellId() { + public Integer getNewPhysicalCellId() { return newPhysicalCellId; } - public void setNewPhysicalCellId(Long newPhysicalCellId) { + public void setNewPhysicalCellId(Integer newPhysicalCellId) { this.newPhysicalCellId = newPhysicalCellId; } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java index af552e3..9666bca 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java @@ -47,6 +47,10 @@ public class NRCellCU implements Serializable, Comparable<NRCellCU> { private Integer cellLocalId; @Column(name = "RESOURCETYPE") private String resourceType; + @Column(name = "SCREENX") + private float screenX; + @Column(name = "SCREENY") + private float screenY; @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "PLMNINFO", joinColumns = @JoinColumn(name = "nrcellcu_celllocalid")) private List<PLMNInfo> pLMNInfoList; @@ -57,6 +61,34 @@ public class NRCellCU implements Serializable, Comparable<NRCellCU> { @JoinColumn(name = "gnbcuname") private GNBCUCPFunction gNBCUCPFunction; + private boolean pciCollisionDetected; + private boolean pciConfusionDetected; + private String color; + + public boolean isPciCollisionDetected() { + return pciCollisionDetected; + } + + public void setPciCollisionDetected(boolean pciCollisionDetected) { + this.pciCollisionDetected = pciCollisionDetected; + } + + public boolean isPciConfusionDetected() { + return pciConfusionDetected; + } + + public void setPciConfusionDetected(boolean pciConfusionDetected) { + this.pciConfusionDetected = pciConfusionDetected; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + public Integer getCellLocalId() { return cellLocalId; } @@ -94,6 +126,12 @@ public class NRCellCU implements Serializable, Comparable<NRCellCU> { this.resourceType = resourceType; } + public void setScreenX(float screenX){ this.screenX = screenX; } + public float getScreenX(){ return screenX; } + + public void setScreenY(float screenY){ this.screenY = screenY; } + public float getScreenY(){ return screenY; } + static Logger log = Logger.getLogger(RansimController.class.getName()); public void display() { diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellRelation.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellRelation.java index e825b04..ae7acb2 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellRelation.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellRelation.java @@ -56,6 +56,16 @@ public class NRCellRelation implements Serializable { @JoinColumn(name = "celllocalid", referencedColumnName="celllocalid") private NRCellCU cellLocalId; + public NRCellRelation() {} + + public NRCellRelation(Integer idNRCellRelation, Integer nRTCI, boolean isHOAllowed, NRCellCU cellLocalId) { + super(); + this.idNRCellRelation = idNRCellRelation; + this.nRTCI = nRTCI; + this.isHOAllowed = isHOAllowed; + this.cellLocalId = cellLocalId; + } + public NRCellCU getCellLocalId() { return cellLocalId; } public void setCellLocalId(NRCellCU cellLocalId) { this.cellLocalId = cellLocalId; } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java index 3c56e26..3eaa1f4 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java @@ -47,7 +47,9 @@ public class NetconfServers { @OneToMany(targetEntity = NRCellCU.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Set<NRCellCU> cellCUList; - + + @OneToMany(targetEntity = NRCellDU.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) + private Set<NRCellDU> cellDUList; public NetconfServers() { @@ -108,4 +110,12 @@ public class NetconfServers { public void setCellList(Set<NRCellCU> cellCUList) { this.cellCUList = cellCUList; } + + public Set<NRCellDU> getDUList() { + return cellDUList; + } + + public void setDUList(Set<NRCellDU> cellDUList) { + this.cellDUList = cellDUList; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java index cbad231..f0addab 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java @@ -20,11 +20,17 @@ package org.onap.ransim.rest.api.repository; +import java.util.List; + import org.onap.ransim.rest.api.models.NRCellCU; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface NRCellCURepository extends CrudRepository<NRCellCU, Integer> { + + @Query("SELECT cd from NRCellCU cd where cd.pciCollisionDetected=true or cd.pciConfusionDetected=true") + List<NRCellCU> getCellsWithCollisionOrConfusion(); } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java index 027c97e..5bfbd44 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java @@ -90,6 +90,7 @@ import org.onap.ransim.websocket.model.GNBCUCPFunction; import org.onap.ransim.websocket.model.ModifyNeighbor; import org.onap.ransim.websocket.model.Neighbor; import org.onap.ransim.websocket.model.SNSSAI; +import org.onap.ransim.websocket.model.NRCellDU; import org.onap.ransim.websocket.model.SetConfigTopology; import org.onap.ransim.websocket.model.Topology; import org.onap.ransim.websocket.model.UpdateCell; @@ -615,24 +616,33 @@ public class RansimControllerServices { public void setRanCUCPNetconfServers(Integer cellLocalId) { NRCellCU currentCell = ransimRepo.getNRCellCUDetail(cellLocalId); + org.onap.ransim.rest.api.models.NRCellDU nrCellDU = ransimRepo.getNRCellDUDetail(cellLocalId); Set<NRCellCU> newList = new HashSet<NRCellCU>(); + Set<org.onap.ransim.rest.api.models.NRCellDU> duList = new HashSet<>(); try { - if (currentCell != null) { + if (currentCell != null && nrCellDU != null) { NetconfServers server = ransimRepo.getNetconfServer(currentCell.getgNBCUCPFunction().getgNBCUName()); - if (server == null) { + NetconfServers duServer = ransimRepo.getNetconfServer(nrCellDU.getgNBDUFunction().getgNBDUId().toString()); + if (server == null || duServer == null) { server = new NetconfServers(); + duServer = new NetconfServers();duServer = new NetconfServers(); server.setServerId(currentCell.getgNBCUCPFunction().getgNBCUName()); + duServer.setServerId(nrCellDU.getgNBDUFunction().getgNBDUId().toString()); } else { newList.addAll(server.getCellList()); - + duList.addAll(duServer.getDUList()); } newList.add(currentCell); + duList.add(nrCellDU); server.setCellList(newList); + duServer.setDUList(duList); log.info("setNetconfServer CUCP: cellLocalId: " + cellLocalId + ", ip: " + server.getIp() + ", portNum: " + server.getNetconfPort() + ", serverId:" + currentCell.getgNBCUCPFunction().getgNBCUName()); - + log.info("setNetconfServer DU : cellLocalId: " + cellLocalId + ", ip: " + server.getIp() + ", portNum: " + server.getNetconfPort() + + ", serverId:" + nrCellDU.getgNBDUFunction().getgNBDUId().toString()); ransimRepo.mergeNetconfServers(server); + ransimRepo.mergeNetconfServers(duServer); } } catch (Exception eu) { log.error("setRanCUCPNetconfServers Function Error", eu); @@ -679,6 +689,43 @@ public class RansimControllerServices { } } + public void generateCluster() { + + List<org.onap.ransim.rest.api.models.NRCellDU> DUList = (List<org.onap.ransim.rest.api.models.NRCellDU>) nRCellDURepository.findAll(); + + for( org.onap.ransim.rest.api.models.NRCellDU nrCellDU : DUList ) { + + double lon = nrCellDU.getLongitude(); + double lat = nrCellDU.getLatitude(); + + double xx = (lon - 0) * RansimUtilities.metersDeglon(0); + double yy = (lat - 0) * RansimUtilities.metersDeglat(0); + + double rad = Math.sqrt(xx * xx + yy * yy); + + if (rad > 0) { + double ct = xx / rad; + + double st = yy / rad; + + xx = rad * ((ct * Math.cos(0)) + (st * Math.sin(0))); + + yy = rad * ((st * Math.cos(0)) - (ct * Math.sin(0))); + + } + + NRCellCU nrCellCU = ransimRepo.getNRCellCUDetail(nrCellDU.getCellLocalId()); + + nrCellCU.setScreenX((float) (xx)); + + nrCellCU.setScreenY((float) (yy)); + + ransimRepo.mergeNRCellCU(nrCellCU); + } + + } + + /** * generateClusterFromFile() * @@ -796,7 +843,7 @@ public class RansimControllerServices { neighborList.setNeighborList(newCell); ransimRepo.mergeCellNeighbor(neighborList); - rsPciHdlr.setCollisionConfusionFromFile(cellNodeId); + rsPciHdlr.setCollisionConfusionFromFile(Integer.valueOf(cellNodeId)); } @@ -1234,7 +1281,6 @@ public class RansimControllerServices { nbr.setIsHOAllowed(cellDetails.isBlacklisted()); nbrList.add(nbr); } - cell.setNeighborList(nbrList); config.add(i, cell); } @@ -1691,7 +1737,7 @@ public class RansimControllerServices { } for (String cl : cellList) { - rsPciHdlr.setCollisionConfusionFromFile(cl); + rsPciHdlr.setCollisionConfusionFromFile(Integer.valueOf(cl)); } rsPciHdlr.updateNbrsOperationsTable(modifyNeighbor.getIdNRCellCU(), source, nbrsAdd, nbrsDel); @@ -1707,32 +1753,31 @@ public class RansimControllerServices { log.info("handleModifyPciFromGUI: cellId:" + cellId + " pciId:" + pciId); try { - CellDetails currentCell = ransimRepo.getCellDetail(cellId); - CellNeighbor neighborList = ransimRepo.getCellNeighbor(cellId); - List<Neighbor> nbrList = new ArrayList<Neighbor>(); - Iterator<NeighborDetails> iter = neighborList.getNeighborList().iterator(); - while (iter.hasNext()) { - NeighborDetails nbCell = iter.next(); - Neighbor nbr = new Neighbor(); - CellDetails nbrCell = ransimRepo.getCellDetail(nbCell.getNeigbor().getNeighborCell()); - - nbr.setIdNRCellRelation(nbrCell.getNodeId()); - nbr.setNRTCI(nbrCell.getPhysicalCellId()); - nbr.setIdGNBCUCPFunction(nbrCell.getNodeName()); - nbr.setServerId(nbrCell.getServerId()); - nbr.setPlmnId(nbrCell.getNetworkId()); - nbrList.add(nbr); + NRCellCU currentCell = ransimRepo.getNRCellCUDetail(Integer.valueOf(cellId)); + List<NRCellRelation> neighborList = currentCell.getNrCellRelationsList(); + + List<org.onap.ransim.websocket.model.NRCellRelation> nrCellList = new ArrayList<>(); + + for(NRCellRelation nrCellRelation : neighborList ) + { + org.onap.ransim.websocket.model.NRCellRelation cellRelation = new org.onap.ransim.websocket.model.NRCellRelation(); + cellRelation.setIdNRCellRelation(nrCellRelation.getIdNRCellRelation()); + AttributesNRRelation attributesNRRelation = new AttributesNRRelation(); + attributesNRRelation.setNRTCI(nrCellRelation.getnRTCI()); + attributesNRRelation.setIsHoAllowed(nrCellRelation.getisHOAllowed()); + cellRelation.setAttributes(attributesNRRelation); + nrCellList.add(cellRelation); } - String pnfName = currentCell.getServerId(); + String pnfName = ransimRepo.getDUName(currentCell.getCellLocalId()); String ipPort = serverIdIpPortMapping.get(pnfName); log.info("handleModifyPciFromGui:ipPort >>>>>>> " + ipPort); if (ipPort != null && !ipPort.trim().equals("")) { String[] ipPortArr = ipPort.split(":"); - Topology oneCell = new Topology(pnfName, pciId, cellId, nbrList); - UpdateCell updatedPci = new UpdateCell(currentCell.getServerId(), ipPortArr[0], ipPortArr[1], oneCell); + Topology oneCell = new Topology(pnfName, pciId, cellId, nrCellList); + UpdateCell updatedPci = new UpdateCell(pnfName, ipPortArr[0], ipPortArr[1], oneCell); Gson gson = new Gson(); String jsonStr = gson.toJson(updatedPci); if (ipPort != null && !ipPort.trim().equals("")) { @@ -1744,7 +1789,7 @@ public class RansimControllerServices { log.info("No client session for " + ipPort); } } else { - log.info("No client for " + currentCell.getServerId()); + log.info("No client for " + pnfName); } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java index 6c607ea..fcf82ee 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java @@ -160,6 +160,49 @@ public class RansimRepositoryService { return rel; } + public Integer getNRPCI(Integer cellLocalId) { + Optional<NRCellDU> du = nRCellDURepo.findById(cellLocalId); + Integer pci = 0; + if (du.isPresent()) { + pci = du.get().getnRPCI(); + } + return pci; + } + + public String getNetworkId(Integer cellLocalId) { + Optional<NRCellDU> du = nRCellDURepo.findById(cellLocalId); + String networkId = null; + if (du.isPresent()) { + networkId = du.get().getNetworkId(); + } + return networkId; + } + + public String getDUName(Integer cellLocalId) { + Optional<NRCellDU> du = nRCellDURepo.findById(cellLocalId); + String duName = null; + if (du.isPresent()) { + duName = du.get().getgNBDUFunction().getgNBDUId().toString(); + } + return duName; + + } + + /** + * Method to retrieve all cell details + * + * @return + */ + + public List<NRCellCU> getCUCellDetailsList() { + Iterable<NRCellCU> cellsList = nRCellCURepo.findAll(); + if (cellsList != null) { + return (List<NRCellCU>) cellsList; + } else { + return new ArrayList<>(); + } + } + /** * Method to retrieve cellCU neighbors * @@ -238,8 +281,8 @@ public class RansimRepositoryService { * * @return */ - public List<CellDetails> getCellsWithCollisionOrConfusion() { - List<CellDetails> cellsList = cellDetailsRepo.getCellsWithCollisionOrConfusion(); + public List<NRCellCU> getCellsWithCollisionOrConfusion() { + List<NRCellCU> cellsList = nRCellCURepo.getCellsWithCollisionOrConfusion(); if (cellsList != null) { return cellsList; } else { @@ -364,6 +407,15 @@ public class RansimRepositoryService { } /** + * Method to save cells + * + * @param nRCellCU + */ + public void mergeNRCellCU(NRCellCU nRCellCU) { + nRCellCURepo.save(nRCellCU); + } + + /** * Method to save neighbors * * @param neighborDetails diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java index 56ce746..34922be 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java @@ -30,7 +30,7 @@ public class Topology { private String cellId; - private List<Neighbor> neighborList; + private List<NRCellRelation> neighborList; public long getPciId() { return pciId; @@ -48,11 +48,11 @@ public class Topology { this.cellId = cellId; } - public List<Neighbor> getNeighborList() { + public List<NRCellRelation> getNeighborList() { return neighborList; } - public void setNeighborList(List<Neighbor> neighborList) { + public void setNeighborList(List<NRCellRelation> neighborList) { this.neighborList = neighborList; } @@ -70,7 +70,7 @@ public class Topology { * @param cellId node id for the cel * @param neighborList neighbor list for the cell */ - public Topology(String pnfName, long pciId, String cellId, List<Neighbor> neighborList) { + public Topology(String pnfName, long pciId, String cellId, List<NRCellRelation> neighborList) { super(); this.pnfName = pnfName; this.pciId = pciId; 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 400089f..d28c4d9 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 @@ -207,11 +207,12 @@ public class TestRansimController { String networkId = "abc"; String ncServer = "nc1"; - String cellId = "Chn00"; + String cellId = "14427"; String collisions = ""; - HashMap<Long,String> confusions = new HashMap<Long,String>(); - collisions += "Chn00"+","+"Chn00"; - confusions.put(Long.valueOf(0),"Chn00");confusions.put(Long.valueOf(1),"Chn00"); + HashMap<Integer, Integer> confusions = new HashMap<Integer, Integer>(); + collisions += "14427"+","+"14427"; + confusions.put(Integer.valueOf(0),14427); + confusions.put(Integer.valueOf(1),14427); FmAlarmInfo issue = new FmAlarmInfo("Collision", collisions, confusions); /* * EventFm eventObj = rscontroller.setEventFm(networkId, ncServer, cellId, diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java index c5ad032..481507d 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java @@ -32,14 +32,14 @@ public class TestApiModels { @Test public void testsetNewPhysicalCellId() { ModifyACellReq mcell = new ModifyACellReq(); - mcell.setNewPhysicalCellId(001L); + mcell.setNewPhysicalCellId(001); assertTrue(mcell.getNewPhysicalCellId() == 001); } @Test public void testsetNewPhysicalCellId1() { ModifyACellReq mcell = new ModifyACellReq(); - mcell.setNewPhysicalCellId(000L); + mcell.setNewPhysicalCellId(000); assertFalse(mcell.getNewPhysicalCellId() == 001); } |