diff options
author | 2022-03-10 10:33:21 +0000 | |
---|---|---|
committer | 2022-05-04 07:15:57 +0000 | |
commit | 944c707bcd818e3581acab1c100710b218fb3c51 (patch) | |
tree | 5ffefb6c3cd497e95eefde27cb1f9dcd8e61aa31 /ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api | |
parent | 3f1910bc0dc08ee51b1300f9b7ad5ac460e56e2c (diff) |
ORAN Alignment - initial config updates and PM data updates for SON usecase
Issue-ID: INT-2082
Signed-off-by: Malarvizhi Paramasivam <malarvizhi.44@wipro.com>
Change-Id: Ie78564746768094070d90e3e14251d40df764bdd
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api')
11 files changed, 590 insertions, 189 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 ddf2513..93b4f5c 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 @@ -345,6 +345,46 @@ public class RansimController { } } + + @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned cellId") + @RequestMapping(value = "/GetCUNeighborList", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot Insert the given parameters")}) + public ResponseEntity<String> getCUNeighborList(@RequestBody GetNeighborListReq req) throws Exception { + + log.debug("Inside getNeighborList..."); + try { + String jsonStr = ""; + GetNeighborList message = rsPciHdlr.generateNeighborList(req.getNodeId()); + if (message != null) { + log.info("message.getNodeId(): " + message.getNodeId()); + Gson gson = new Gson(); + jsonStr = gson.toJson(message); + } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + } catch (Exception eu) { + log.info("/getCUNeighborList", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @ApiOperation("Sets the netconfserver for the cellId") + @RequestMapping(value = "/SetCUCPNetconfServer", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot Insert the given parameters")}) + public ResponseEntity<String> setNetconfServer(@RequestBody Integer cellLocalId) throws Exception { + log.debug("Inside setNetconfServer..."); + try { + rscServices.setRanCUCPNetconfServers(cellLocalId); + return new ResponseEntity<>("Server set. ", HttpStatus.OK); + } catch (Exception eu) { + log.info("/SetCUCPNetconfServer", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + /** * The function retrieves the neighbor list for the cell with the mentioned * nodeId. 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 6ba89c2..48d78c5 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 @@ -44,6 +44,8 @@ import org.onap.ransim.rest.api.models.FmAlarmInfo; 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.NRCellRelation; import org.onap.ransim.rest.api.models.OperationLog; import org.onap.ransim.rest.api.models.PmDataDump; import org.onap.ransim.rest.api.models.PmParameters; @@ -171,41 +173,41 @@ public class RansimPciHandler { * @return Returns GetNeighborList object */ public GetNeighborList generateNeighborList(String nodeId) { - - try { - log.info("inside generateNeighborList for: " + nodeId); - CellNeighbor neighborList = ransimRepo.getCellNeighbor(nodeId); - GetNeighborList result = new GetNeighborList(); - neighborList.display(); - List<CellDetails> cellsWithNoHO = new ArrayList<CellDetails>(); - List<CellDetails> cellsWithHO = new ArrayList<CellDetails>(); - - List<NeighborDetails> nbrList = new ArrayList<>(); - if (neighborList != null) { - nbrList.addAll(neighborList.getNeighborList()); - } - - for (int i = 0; i < nbrList.size(); i++) { - - CellDetails nbr = ransimRepo.getCellDetail(nbrList.get(i).getNeigbor().getNeighborCell()); - - if (nbrList.get(i).isBlacklisted()) { - cellsWithNoHO.add(nbr); - } else { - cellsWithHO.add(nbr); - } - - } - - result.setNodeId(nodeId); - result.setCellsWithHo(cellsWithHO); - result.setCellsWithNoHo(cellsWithNoHO); - return result; - - } catch (Exception eu) { - log.info("/getNeighborList", eu); - return null; - } + + try { + log.info("inside generateNeighborList for: " + nodeId); + NRCellCU neighborList = ransimRepo.getCellRelation(Integer.valueOf(nodeId)); + GetNeighborList result = new GetNeighborList(); + neighborList.display(); + + List<NRCellCU> cellsWithNoHO = new ArrayList<>(); + List<NRCellCU> cellsWithHO = new ArrayList<>(); + + List<NRCellRelation> nbrList = new ArrayList<>(); + if (neighborList != null) { + nbrList.addAll(neighborList.getNrCellRelationsList()); + log.info("neighborList.getNrCellRelationsList() is : " + nbrList); + } + + for (int i = 0; i < nbrList.size(); i++) { + NRCellCU nbr = ransimRepo.getNRCellCUDetail(nbrList.get(i).getIdNRCellRelation()); + if (nbrList.get(i).getisHOAllowed()) { + cellsWithHO.add(nbr); + log.info("cellswithHO is : " + cellsWithHO); + } else { + cellsWithNoHO.add(nbr); + log.info("cellswithNoHO is : " + cellsWithNoHO); + } + } + result.setNodeId(nodeId); + result.setCUCellsWithHo(cellsWithHO); + result.setCUCellsWithNoHo(cellsWithNoHO); + log.info(" Generate neighbour result is : " + result); + return result; + } catch (Exception eu) { + log.info("/getCUNeighborList", eu); + return null; + } } public void checkCollisionAfterModify() { @@ -535,6 +537,8 @@ public class RansimPciHandler { @Transactional public List<String> generatePmData(String nodeIdBad, String nodeIdPoor) { + log.info(" nodeIdBad in generatePmData is" + nodeIdBad); + log.info(" nodeIdPoor in generatePmData is" + nodeIdPoor); List<String> result = new ArrayList<>(); String parameter1 = ""; @@ -555,13 +559,21 @@ public class RansimPciHandler { try { log.info("next : " + next); parameter1 = pmParameters.get(next).getParameter1(); + log.info("parameter1 is : " + parameter1); successValue1 = pmParameters.get(next).getSuccessValue1(); + log.info("successValue1 is : " + successValue1); badValue1 = pmParameters.get(next).getBadValue1(); + log.info("badValue1 is : " + badValue1); poorValue1 = pmParameters.get(next).getPoorValue1(); + log.info("poorValue1 is : " + poorValue1); parameter2 = pmParameters.get(next).getParameter2(); + log.info("parameter2 is : " + parameter2); successValue2 = pmParameters.get(next).getSuccessValue2(); + log.info("successValue2 is : " + successValue2); badValue2 = pmParameters.get(next).getBadValue2(); + log.info("badValue2 is : " + badValue2); poorValue2 = pmParameters.get(next).getPoorValue2(); + log.info("poorValue2 is : " + poorValue2); next++; } catch (Exception e) { log.info("Exception: ", e); @@ -578,149 +590,141 @@ public class RansimPciHandler { cellIdsBad = nodeIdBad.split(","); for (int a = 0; a < cellIdsBad.length; a++) { nodeIdsBad.add(cellIdsBad[a].trim()); + log.info("nodeIds bad is : " + nodeIdsBad); + } } if (nodeIdPoor != null) { cellIdsPoor = nodeIdPoor.split(","); for (int a = 0; a < cellIdsPoor.length; a++) { nodeIdsPoor.add(cellIdsPoor[a].trim()); + log.info("nodeIds poor is : " + nodeIdsPoor); } } for (int i = 0; i < cnl.size(); i++) { - long startTime = System.currentTimeMillis(); - List<CellDetails> cellList = new ArrayList<CellDetails>(cnl.get(i).getCells()); - List<EventPm> data = new ArrayList<EventPm>(); - - for (int j = 0; j < cellList.size(); j++) { - - long startTimeCell = System.currentTimeMillis(); - String nodeId = cellList.get(j).getNodeId(); - EventPm event = new EventPm(); - CommonEventHeaderPm commonEventHeader = new CommonEventHeaderPm(); - commonEventHeader.setSourceName(nodeId); - commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); - String uuid = globalPmCellIdUuidMap.get(nodeId); - if (uuid == null) { - uuid = getUuid(); - globalPmCellIdUuidMap.put(nodeId, uuid); - } - commonEventHeader.setSourceUuid(uuid); - - Measurement measurement = new Measurement(); - measurement.setMeasurementInterval(180); - - GetNeighborList cellNbrList = generateNeighborList(nodeId); - - long startTimeCheckBadPoor = System.currentTimeMillis(); - - boolean checkBad = false; - boolean checkPoor = false; - int countBad = 0; - int countPoor = 0; - - if (nodeIdsBad.contains(nodeId)) { - checkBad = true; - countBad = (int) (cellNbrList.getCellsWithHo().size() * 0.2); - } - if (nodeIdsPoor.contains(nodeId)) { - checkPoor = true; - countPoor = (int) (cellNbrList.getCellsWithHo().size() * 0.2); - } - - long endTimeCheckBadPoor = System.currentTimeMillis(); - log.debug("Time taken CheckBadPoor : " + (endTimeCheckBadPoor - startTimeCheckBadPoor)); - List<AdditionalMeasurements> additionalMeasurements = new ArrayList<AdditionalMeasurements>(); - if (checkPoor || checkBad) { - - Collections.sort(cellNbrList.getCellsWithHo()); - - for (int k = 0; k < cellNbrList.getCellsWithHo().size(); k++) { - AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); - addMsmnt.setName(cellNbrList.getCellsWithHo().get(k).getNodeId()); - Map<String, String> hashMap = new HashMap<String, String>(); - hashMap.put("networkId", cellNbrList.getCellsWithHo().get(k).getNetworkId()); - - hashMap.put(parameter1, successValue1); - - if (checkBad == true) { - - if (countBad > 0) { - log.info("countBad: " + countBad); - hashMap.put(parameter2, badValue2); - countBad--; - } else { - hashMap.put(parameter2, successValue2); - } - - } else if (checkPoor == true) { - if (countPoor > 0) { - log.info("countBad: " + countPoor); - hashMap.put(parameter2, poorValue2); - countPoor--; - } else { - hashMap.put(parameter2, successValue2); - } - - } - - addMsmnt.setHashMap(hashMap); - - additionalMeasurements.add(addMsmnt); - - } - } else { - for (int k = 0; k < cellNbrList.getCellsWithHo().size(); k++) { - AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); - addMsmnt.setName(cellNbrList.getCellsWithHo().get(k).getNodeId()); - Map<String, String> hashMap = new HashMap<String, String>(); - - hashMap.put("networkId", cellNbrList.getCellsWithHo().get(k).getNetworkId()); - - hashMap.put(parameter1, successValue1); - - hashMap.put(parameter2, successValue2); - - addMsmnt.setHashMap(hashMap); - additionalMeasurements.add(addMsmnt); - } - } - - commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); - measurement.setAdditionalMeasurements(additionalMeasurements); - - event.setCommonEventHeader(commonEventHeader); - event.setMeasurement(measurement); - - data.add(event); - long endTimeCell = System.currentTimeMillis(); - log.debug("Time taken to Process Cell list : " + (endTimeCell - startTimeCell)); - } - - long endTime = System.currentTimeMillis(); - log.info("Time taken for generating PM data for " + cnl.get(i).getServerId() + " : " - + (endTime - startTime)); - PmMessage msg = new PmMessage(); - - if (data.size() > 0) { - msg.setEventPmList(data); - Gson gson = new Gson(); - String jsonStr = gson.toJson(msg); - sendPmdata(cnl.get(i).getServerId(), jsonStr); - - result.add(jsonStr); - } - - } - } catch (Exception e) { - log.info("Exception in string builder", e); - } - - return result; + long startTime = System.currentTimeMillis(); + List<NRCellCU> cellList = new ArrayList<NRCellCU>(cnl.get(i).getCellList()); + log.info(" CellList in generatePmData is : " + cellList); + List<EventPm> data = new ArrayList<EventPm>(); + for (int j = 0; j < cellList.size(); j++) { + + long startTimeCell = System.currentTimeMillis(); + String nodeId = cellList.get(j).getCellLocalId().toString(); + log.info(" nodeId in cellList in generatePmData is : " + nodeId); + String reportingEntityName = cellList.get(j).getgNBCUCPFunction().getgNBCUName(); + EventPm event = new EventPm(); + CommonEventHeaderPm commonEventHeader = new CommonEventHeaderPm(); + commonEventHeader.setSourceName(nodeId); + commonEventHeader.setReportingEntityName(reportingEntityName); + commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + String uuid = globalPmCellIdUuidMap.get(nodeId); + if (uuid == null) { + uuid = getUuid(); + globalPmCellIdUuidMap.put(nodeId, uuid); + } + commonEventHeader.setSourceUuid(uuid); + Measurement measurement = new Measurement(); + measurement.setMeasurementInterval(180); + + GetNeighborList cellNbrList = generateNeighborList(nodeId); + log.info("Get CellCU neighbourList with HO is : " + cellNbrList.getCUCellsWithHo()); + + long startTimeCheckBadPoor = System.currentTimeMillis(); + boolean checkBad = false; + boolean checkPoor = false; + int countBad = 0; + int countPoor = 0; + log.info( "nodeIdsBad in for loop is" + nodeIdsBad); + log.info( "nodeIdsPoor in for loop is" + nodeIdsPoor); + + if (nodeIdsBad.contains(nodeId)) { + log.info( " inside nodeIdsBad if condition " + nodeId); + checkBad = true; + countBad = (int) (cellNbrList.getCUCellsWithHo().size() * 0.2); + log.info( " check bad is : " + checkBad); + log.info( " count bad is : " + countBad); + } + + if (nodeIdsPoor.contains(nodeId)) { + log.info( " inside nodeIdsPoor if condition " + nodeId); + checkPoor = true; + countPoor = (int) (cellNbrList.getCUCellsWithHo().size() * 0.2); + log.info( " check poor is : " + checkPoor); + log.info( " count bad is : " + countPoor); + } + + long endTimeCheckBadPoor = System.currentTimeMillis(); + log.debug("Time taken CheckBadPoor : " + (endTimeCheckBadPoor - startTimeCheckBadPoor)); + List<AdditionalMeasurements> additionalMeasurements = new ArrayList<AdditionalMeasurements>(); + if (checkPoor || checkBad) { + Collections.sort(cellNbrList.getCUCellsWithHo()); + for (int k = 0; k < cellNbrList.getCUCellsWithHo().size(); k++) { + AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); + addMsmnt.setName(cellNbrList.getCUCellsWithHo().get(k).getCellLocalId().toString()); + Map<String, String> hashMap = new HashMap<String, String>(); + hashMap.put("networkId", "RAN001"); + hashMap.put(parameter1, successValue1); + if (checkBad == true) { + if (countBad > 0) { + log.info("countBad: " + countBad); + hashMap.put(parameter2, badValue2); + countBad--; + } else { + hashMap.put(parameter2, successValue2); + } + } else if (checkPoor == true) { + if (countPoor > 0) { + log.info("countPoor: " + countPoor); + hashMap.put(parameter2, poorValue2); + countPoor--; + } else { + hashMap.put(parameter2, successValue2); + } + } + addMsmnt.setHashMap(hashMap); + additionalMeasurements.add(addMsmnt); + } + } else { + for (int k = 0; k < cellNbrList.getCUCellsWithHo().size(); k++) { + AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); + addMsmnt.setName(cellNbrList.getCUCellsWithHo().get(k).getCellLocalId().toString()); + Map<String, String> hashMap = new HashMap<String, String>(); + hashMap.put("networkId", "RAN001"); + hashMap.put(parameter1, successValue1); + hashMap.put(parameter2, successValue2); + addMsmnt.setHashMap(hashMap); + additionalMeasurements.add(addMsmnt); + } + } + commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + measurement.setAdditionalMeasurements(additionalMeasurements); + event.setCommonEventHeader(commonEventHeader); + event.setMeasurement(measurement); + data.add(event); + long endTimeCell = System.currentTimeMillis(); + log.debug("Time taken to Process Cell list : " + (endTimeCell - startTimeCell)); + } + long endTime = System.currentTimeMillis(); + log.info("Time taken for generating PM data for " + cnl.get(i).getServerId() + " : " + + (endTime - startTime)); + PmMessage msg = new PmMessage(); + if (data.size() > 0) { + msg.setEventPmList(data); + Gson gson = new Gson(); + String jsonStr = gson.toJson(msg); + sendPmdata(cnl.get(i).getServerId(), jsonStr); + result.add(jsonStr); + } + } + } catch (Exception e) { + log.info("Exception in string builder", e); + } + return result; } - - /** + + /** * Sets the value for all fields in the FM data for individual cell. * * @param networkId diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java index 11e8019..ed32bf3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java @@ -25,6 +25,8 @@ import java.util.List; public class GetNeighborList { private String nodeId; + private List<NRCellCU> CellsWithNoHo; + private List<NRCellCU> CellsWithHo; private List<CellDetails> cellsWithNoHo; private List<CellDetails> cellsWithHo; @@ -70,4 +72,19 @@ public class GetNeighborList { this.cellsWithHo = cellsWithHo; } + public List<NRCellCU> getCUCellsWithNoHo() { + return CellsWithNoHo; + } + + public void setCUCellsWithNoHo(List<NRCellCU> CellsWithNoHo) { + this.CellsWithNoHo = CellsWithNoHo; + } + + public List<NRCellCU> getCUCellsWithHo() { + return CellsWithHo; + } + + public void setCUCellsWithHo(List<NRCellCU> CellsWithHo) { + this.CellsWithHo = CellsWithHo; + } } 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 2d49f63..af552e3 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Ran Simulator Controller * ================================================================================ - * Copyright (C) 2020-2021 Wipro Limited. + * Copyright (C) 2020-2022 Wipro Limited. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,10 @@ package org.onap.ransim.rest.api.models; import java.io.Serializable; +import org.apache.log4j.Logger; import java.util.List; +import java.util.ArrayList; +import org.onap.ransim.rest.api.controller.RansimController; import javax.persistence.CascadeType; import javax.persistence.CollectionTable; @@ -37,7 +40,7 @@ import javax.persistence.Table; @Entity @Table(name = "NRCELLCU") -public class NRCellCU implements Serializable { +public class NRCellCU implements Serializable, Comparable<NRCellCU> { private static final long serialVersionUID = 1L; @Id @Column(name = "CELLLOCALID") @@ -47,6 +50,9 @@ public class NRCellCU implements Serializable { @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "PLMNINFO", joinColumns = @JoinColumn(name = "nrcellcu_celllocalid")) private List<PLMNInfo> pLMNInfoList; + @Column(name = "NRCELLRELATIONLIST") + @OneToMany(mappedBy = "cellLocalId", cascade = CascadeType.ALL) + private List<NRCellRelation> nrCellRelationsList; @ManyToOne @JoinColumn(name = "gnbcuname") private GNBCUCPFunction gNBCUCPFunction; @@ -58,6 +64,11 @@ public class NRCellCU implements Serializable { public void setCellLocalId(Integer cellLocalId) { this.cellLocalId = cellLocalId; } + public List<NRCellRelation> getNrCellRelationsList() { return nrCellRelationsList; } + + public void setNrCellRelationsList(List<NRCellRelation> nrCellRelationsList) { + this.nrCellRelationsList = nrCellRelationsList; + } public List<PLMNInfo> getpLMNInfoList() { return pLMNInfoList; @@ -83,4 +94,20 @@ public class NRCellCU implements Serializable { this.resourceType = resourceType; } + static Logger log = Logger.getLogger(RansimController.class.getName()); + + public void display() { + + List<NRCellRelation> iterator = new ArrayList<>(nrCellRelationsList); + for (int ii = 0; ii < iterator.size(); ii++) { + log.info("neighbors NeighborList: " + iterator.get(ii).getCellLocalId()+ " " + + iterator.get(ii).getIdNRCellRelation() + " " + iterator.get(ii).getisHOAllowed()); + } + } + + @Override + public int compareTo(NRCellCU cd) { + return this.getCellLocalId().compareTo(cd.getCellLocalId()); + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java index 4bd9f1c..0172049 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java @@ -48,6 +48,12 @@ public class NRCellDU implements Serializable { private String administrativeState; @Column(name = "CELLSTATE") private String cellState; + @Column(name = "LATITUDE") + private Double latitude; + @Column(name = "LONGITUDE") + private Double longitude; + @Column(name = "NETWORKID") + private String networkId; @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "PLMNINFO", joinColumns = @JoinColumn(name = "nrcelldu_celllocalid")) private List<PLMNInfo> pLMNInfoList; @@ -63,6 +69,30 @@ public class NRCellDU implements Serializable { @Column(name = "prb") private Integer prbs; + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + public Integer getCellLocalId() { return cellLocalId; } 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 new file mode 100644 index 0000000..e825b04 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellRelation.java @@ -0,0 +1,74 @@ +/* + ** ============LICENSE_START======================================================= + ** Ran Simulator Controller + ** ================================================================================ + ** Copyright (C) 2022 Wipro Limited. + ** ================================================================================ + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + ** ============LICENSE_END========================================================= + **/ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "NRCELLRELATION") +public class NRCellRelation implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer sno; + + @Column(name = "IDNRCELLRELATION") + private Integer idNRCellRelation; + @Column(name = "nRTCI") + private Integer nRTCI; + @Column(name = "ISHOALLOWED") + private boolean isHOAllowed; + @ManyToOne + @JoinColumn(name = "celllocalid", referencedColumnName="celllocalid") + private NRCellCU cellLocalId; + + public NRCellCU getCellLocalId() { return cellLocalId; } + + public void setCellLocalId(NRCellCU cellLocalId) { this.cellLocalId = cellLocalId; } + + public Integer getIdNRCellRelation() { return idNRCellRelation; } + + public void setIdNRCellRelation(Integer idNRCellRelation) { this.idNRCellRelation = idNRCellRelation; } + + public Integer getnRTCI() { return nRTCI; } + + public void setnRTCI(Integer nRTCI) { this.nRTCI = nRTCI; } + + public boolean getisHOAllowed() { return isHOAllowed; } + + public void setisHOAllowed(boolean isHOAllowed) { this.isHOAllowed = isHOAllowed; } +} 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 a33f616..3c56e26 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 @@ -21,7 +21,8 @@ package org.onap.ransim.rest.api.models; import java.util.Set; - +import java.util.Collection; +import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -44,6 +45,10 @@ public class NetconfServers { @OneToMany(targetEntity = CellDetails.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Set<CellDetails> cells; + @OneToMany(targetEntity = NRCellCU.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) + private Set<NRCellCU> cellCUList; + + public NetconfServers() { } @@ -96,4 +101,11 @@ public class NetconfServers { this.cells = cells; } + public Set<NRCellCU> getCellList() { + return cellCUList; + } + + public void setCellList(Set<NRCellCU> cellCUList) { + this.cellCUList = cellCUList; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellRelationRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellRelationRepository.java new file mode 100644 index 0000000..7e8f6ed --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellRelationRepository.java @@ -0,0 +1,30 @@ +/* =============LICENSE_START======================================================= + * Ran Simulator Controller + ** ================================================================================ + ** Copyright (C) 2022 Wipro Limited. + ** ================================================================================ + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + ** ============LICENSE_END========================================================= + **/ + + + package org.onap.ransim.rest.api.repository; + + import org.onap.ransim.rest.api.models.NRCellRelation; + import org.springframework.data.repository.CrudRepository; + import org.springframework.stereotype.Repository; + + @Repository + public interface NRCellRelationRepository extends CrudRepository<NRCellRelation, Integer>{ + } + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java index 36bd48a..01ef2f1 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java @@ -44,10 +44,12 @@ import org.onap.ransim.rest.api.models.RANSliceInfo; import org.onap.ransim.rest.api.models.RRMPolicyRatio; import org.onap.ransim.rest.api.models.SliceProfile; import org.onap.ransim.rest.api.models.TACells; +import org.onap.ransim.rest.api.models.*; import org.onap.ransim.rest.api.repository.GNBCUCPRepository; import org.onap.ransim.rest.api.repository.GNBCUUPRepository; import org.onap.ransim.rest.api.repository.GNBDURepository; import org.onap.ransim.rest.api.repository.NRCellCURepository; +import org.onap.ransim.rest.api.repository.NRCellRelationRepository; import org.onap.ransim.rest.api.repository.NearRTRICRepository; import org.onap.ransim.rest.api.repository.RANInventoryRepository; import org.onap.ransim.rest.api.repository.RRMPolicyRepository; @@ -56,6 +58,7 @@ import org.onap.ransim.rest.web.mapper.GNBCUCPModel; import org.onap.ransim.rest.web.mapper.GNBCUUPModel; import org.onap.ransim.rest.web.mapper.GNBDUModel; import org.onap.ransim.rest.web.mapper.NRCellCUModel; +import org.onap.ransim.rest.web.mapper.*; import org.onap.ransim.rest.web.mapper.NRCellDUModel; import org.onap.ransim.rest.web.mapper.NearRTRICModel; import org.onap.ransim.rest.web.mapper.RANSliceInfoModel; @@ -77,6 +80,9 @@ public class RANSliceConfigService { @Autowired private GNBDURepository gNBDURepository; + + @Autowired + private NRCellRelationRepository nRCellRelationRepository; @Autowired private NearRTRICRepository nearRTRICRepository; @@ -157,6 +163,7 @@ public class RANSliceConfigService { logger.debug("Error occured during saveGNBCUCP" + e.getMessage()); return null; } + logger.info("saved gNBCUCPmodel is : " + gNBCUCPModel); return gNBCUCPModel; } @@ -652,9 +659,23 @@ public class RANSliceConfigService { logger.debug("Request received to fetch all NearRTRICModel"); modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); List<NearRTRIC> rtricList = (List<NearRTRIC>) nearRTRICRepository.findAll(); + logger.info ("NearRTRIC model is from findall is : " + rtricList); List<NearRTRICModel> rtricmodels = rtricList.stream() .map(rtricEntity -> modelMapper.map(rtricEntity, NearRTRICModel.class)).collect(Collectors.toList()); + logger.info ("NearRTRIC model after mapping is : " + rtricmodels); return rtricmodels; } + public List<NRCellRelationModel> findAllNRCellRelation() { + logger.debug("Request received to fetch all NRCellRelationModel"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + + List<NRCellRelation> relationList = (List<NRCellRelation>) nRCellRelationRepository.findAll(); + logger.info ("NRCellRelation model is from findall is : " + relationList); + List<NRCellRelationModel> nRCellRelationmodels = relationList.stream() + .map(relationEntity -> modelMapper.map(relationEntity, NRCellRelationModel.class)).collect(Collectors.toList()); + logger.info ("NRCellRelation model after mapping is : " + nRCellRelationmodels); + return nRCellRelationmodels; + } + } 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 514666f..924f9b1 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 @@ -57,6 +57,7 @@ import org.onap.ransim.rest.api.models.NbrDump; 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.PLMNInfo; import org.onap.ransim.rest.api.models.RRMPolicyMember; import org.onap.ransim.rest.api.models.RRMPolicyRatio; @@ -72,6 +73,8 @@ import org.onap.ransim.rest.client.RestClient; import org.onap.ransim.rest.web.mapper.GNBCUCPModel; import org.onap.ransim.rest.web.mapper.GNBCUUPModel; import org.onap.ransim.rest.web.mapper.GNBDUModel; +import org.onap.ransim.rest.web.mapper.NRRelationData; +import org.onap.ransim.rest.web.mapper.NRCellRelationModel; import org.onap.ransim.rest.web.mapper.NRCellCUModel; import org.onap.ransim.rest.web.mapper.NRCellDUModel; import org.onap.ransim.rest.web.mapper.NSSAIData; @@ -82,6 +85,7 @@ import org.onap.ransim.utilities.RansimUtilities; import org.onap.ransim.websocket.model.*; import org.onap.ransim.websocket.model.ConfigData; import org.onap.ransim.websocket.model.ConfigPLMNInfo; +import org.onap.ransim.websocket.model.GNBCUCPFunction; import org.onap.ransim.websocket.model.ModifyNeighbor; import org.onap.ransim.websocket.model.ModifyPci; import org.onap.ransim.websocket.model.Neighbor; @@ -447,8 +451,9 @@ public class RansimControllerServices { } public void loadGNBFunctionProperties() { - try { - sdnrServerIp = System.getenv("SDNR_IP"); + try { + + sdnrServerIp = System.getenv("SDNR_IP"); sdnrServerPort = Integer.parseInt(System.getenv("SDNR_PORT")); sdnrServerUserid = System.getenv("SDNR_USER"); sdnrServerPassword = System.getenv("SDNR_PASSWORD"); @@ -458,11 +463,10 @@ public class RansimControllerServices { List<String> gNBList = new ArrayList<>(); for (GNBCUCPModel gNBCUCPModel : rtricModel.getgNBCUCPList()) { gNBList.add(gNBCUCPModel.getgNBCUName()); - setRanNetconfServers(gNBCUCPModel.getgNBCUName()); for (NRCellCUModel nRCellCUModel : gNBCUCPModel.getCellCUList()) { - if (nRCellCUModel.getpLMNInfoList().isEmpty()) { + if (nRCellCUModel.getpLMNInfoList().isEmpty()) { org.json.simple.parser.JSONParser jsonParser = new org.json.simple.parser.JSONParser(); - try (FileReader reader = new FileReader("/tmp/ransim-install/config/gNBCUConfig.json")) { + try (FileReader reader = new FileReader("/tmp/ransim-install/config/ransimdata.json")) { // Read JSON file Object obj = jsonParser.parse(reader); JSONArray List = (JSONArray) obj; @@ -481,6 +485,24 @@ public class RansimControllerServices { for (int j = 0; j < cellList.size(); j++) { JSONObject cell = (JSONObject) cellList.get(j); Long cellLocalId = (Long) cell.get("cellLocalId"); + String nRCellRelVar = (String) cell.get("nRCellRelationList").toString(); + Object nRCellVarObj = jsonParser.parse(nRCellRelVar); + JSONArray nRCellRelList = (JSONArray) nRCellVarObj; + List<NRCellRelationModel> nrCellRelationModelList = new ArrayList<NRCellRelationModel>(); + for (int k = 0; k < nRCellRelList.size(); k++) { + JSONObject nrcellrel = (JSONObject) nRCellRelList.get(k); + Long idNRCellRelation = (Long) nrcellrel.get("idNRCellRelation"); + JSONObject attributes = (JSONObject) nrcellrel.get("attributes"); + Long nRTCI = (Long) attributes.get("nRTCI"); + String isHOAllowed = (String) attributes.get("isHOAllowed"); + NRRelationData nrRelationDataObj = new NRRelationData(); + nrRelationDataObj.setNRTCI(nRTCI.intValue()); + nrRelationDataObj.setIsHOAllowed(Boolean.valueOf(isHOAllowed)); + NRCellRelationModel nrCellRelationModel = new NRCellRelationModel(); + nrCellRelationModel.setIdNRCellRelation(idNRCellRelation.intValue()); + nrCellRelationModel.setNRRelationData(nrRelationDataObj); + nrCellRelationModelList.add(nrCellRelationModel); + } String plmVar = (String) cell.get("pLMNInfoList").toString(); Object pmlVarObj = jsonParser.parse(plmVar); JSONArray pmlList = (JSONArray) pmlVarObj; @@ -506,8 +528,30 @@ public class RansimControllerServices { } NRCellCUModel nrCellCUModel = new NRCellCUModel(); nrCellCUModel.setCellLocalId(cellLocalId.intValue()); + nrCellCUModel.setNRCellRelation(nrCellRelationModelList); nrCellCUModel.setpLMNInfoList(plmnInfoModelList); + List<String> attachedNoeds; + if (serverIdIpNodeMapping.isEmpty()) { + attachedNoeds = new ArrayList<String>(); + attachedNoeds.add(Integer.toString(nrCellCUModel.getCellLocalId())); + serverIdIpNodeMapping.put(gNBCUCPModel.getgNBCUName(), attachedNoeds); + if (attachedNoeds.size() > numberOfCellsPerNcServer) { + log.info("Attaching Cell:"); + } + } else { + attachedNoeds = serverIdIpNodeMapping.get(gNBCUCPModel.getgNBCUName()); + attachedNoeds.add(Integer.toString(nrCellCUModel.getCellLocalId())); + serverIdIpNodeMapping.put(gNBCUCPModel.getgNBCUName(), attachedNoeds); + if (attachedNoeds.size() > numberOfCellsPerNcServer) { + log.info("Attaching Cell:"); + } + } + log.info("Attaching Cell:" + nrCellCUModel.getCellLocalId() + " to " + + gNBCUCPModel.getgNBCUName()); + setRanCUCPNetconfServers(nrCellCUModel.getCellLocalId()); + dumpSessionDetails(); nRCellCUModelList.add(nrCellCUModel); + log.info("NRCELLCU LIST is : " + nRCellCUModelList); } GNBCUCPModel gNBModel = new GNBCUCPModel(); gNBModel.setgNBCUName(gNBCUName); @@ -518,6 +562,7 @@ public class RansimControllerServices { gNBModel.setNearRTRICId(nearRTRICId.intValue()); gNBModel.setCellCUList(nRCellCUModelList); ranSliceConfigService.saveGNBCUCP(gNBModel); + log.info("gnBCUCP model is: " + gNBModel); } } catch (Exception e) { log.error("Properties file error", e); @@ -533,29 +578,60 @@ public class RansimControllerServices { gNBList.add(gNBDUModel.getgNBDUId().toString()); setRanNetconfServers(gNBDUModel.getgNBDUId().toString()); } + log.info(" gNBList in loadGNB is : " + gNBList); unassignedrtRicIds.add(rtricModel.getNearRTRICId().toString()); ricIdFunctionMapping.put(rtricModel.getNearRTRICId().toString(), gNBList); setRanNetconfServers(rtricModel.getNearRTRICId().toString()); - } - } catch (Exception e) { - log.error("Properties file error", e); - } + + } + } catch (Exception e) { + log.error("Properties file error", e); + } } public void setRanNetconfServers(String serverId) { - try { + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server == null) { + server = new NetconfServers(); + server.setServerId(serverId); + } + ransimRepo.mergeNetconfServers(server); + + } catch (Exception eu) { + log.error("setRanNetconfServers Function Error", eu); + + + } - NetconfServers server = ransimRepo.getNetconfServer(serverId); - if (server == null) { - server = new NetconfServers(); - server.setServerId(serverId); - } - ransimRepo.mergeNetconfServers(server); - - } catch (Exception eu) { - log.error("setNetconfServers Function Error", eu); + } - } + + public void setRanCUCPNetconfServers(Integer cellLocalId) { + + NRCellCU currentCell = ransimRepo.getNRCellCUDetail(cellLocalId); + Set<NRCellCU> newList = new HashSet<NRCellCU>(); + + try { + if (currentCell != null) { + NetconfServers server = ransimRepo.getNetconfServer(currentCell.getgNBCUCPFunction().getgNBCUName()); + if (server == null) { + server = new NetconfServers(); + server.setServerId(currentCell.getgNBCUCPFunction().getgNBCUName()); + } else { + newList.addAll(server.getCellList()); + + } + newList.add(currentCell); + server.setCellList(newList); + log.info("setNetconfServer CUCP: cellLocalId: " + cellLocalId + ", ip: " + server.getIp() + ", portNum: " + server.getNetconfPort() + + ", serverId:" + currentCell.getgNBCUCPFunction().getgNBCUName()); + + ransimRepo.mergeNetconfServers(server); + } + } catch (Exception eu) { + log.error("setRanCUCPNetconfServers Function Error", eu); + } } /** @@ -981,6 +1057,7 @@ public class RansimControllerServices { } for (NearRTRICModel rtRicModel : rtricModelList) { + log.info(" rtric model in sendRanInintialConfig is : " + rtricModelList); if (rtRicModel.getNearRTRICId().toString().equals(serverId)) { getInitalConfigTree(rtRicModel, serverId); NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin", server.getServerId(), @@ -1023,6 +1100,7 @@ public class RansimControllerServices { attributes.setLocationName("Palmdale"); attributes.setgNBId(rtRicModel.getgNBId().toString()); nearRTRIC.setAttributes(attributes); + log.info("RTRIC model is : " + rtRicModel); List<GNBCUUPFunction> gNBCUUPFunctionList = new ArrayList<>(); for (GNBCUUPModel gNBCUUPModel : rtRicModel.getgNBCUUPList()) { @@ -1059,6 +1137,39 @@ public class RansimControllerServices { gNBDUFunctionList.add(gNBDUFunction); } } + /* List<GNBCUCPFunction> gNBCUCPFunctionList = new ArrayList<>(); + for (GNBCUCPModel gnbcucpModel : rtRicModel.getgNBCUCPList()){ + if (gnbcucpModel.getgNBId().toString().equals(serverId) + || rtRicModel.getNearRTRICId().toString().equals(serverId)) { + GNBCUCPFunction gNBCUCPFunction = new GNBCUCPFunction(); + Attributes cUCPattributes = new Attributes(); + cUCPattributes.setgNBId(gnbcucpModel.getgNBId().toString()); + gNBCUCPFunction.setAttributes(cUCPattributes); + gNBCUCPFunction.setIdGNBCUCPFunction(gnbcucpModel.getgNBCUName()); + List<NRCellCU> nRCellCUList = new ArrayList<>(); + for (NRCellCUModel nRCellCUModel : gnbcucpModel.getCellCUList()) { + NRCellCU nRCellCU = new NRCellCU(); + log.info("gnbcucpModel from DB:"+gnbcucpModel); + nRCellCU.setIdNRCellCU(nRCellCUModel.getCellLocalId().toString()); + List<NRCellRelation> nRCellRelationList = new ArrayList<NRCellRelation>(); + for(NRCellRelationModel nrCellRelationModel : nRCellCUModel.getNRCellRelationList()) + { + NRCellRelation nRCellRelation = new NRCellRelation(); + nRCellRelation.setIdNRCellRelation(nrCellRelationModel.getIdNRCellRelation()); + AttributesNRRelation attributesNRRelation = new AttributesNRRelation(); + attributesNRRelation.setNRTCI(nrCellRelationModel.getNRRelationData().getNRTCI()); + attributesNRRelation.setIsHoAllowed(nrCellRelationModel.getNRRelationData().getIsHOAllowed()); + nRCellRelation.setAttributes(attributesNRRelation); + nRCellRelationList.add(nRCellRelation); + nRCellCU.setNRCellRelation(nRCellRelationList); + } + nRCellCUList.add(nRCellCU); + } + gNBCUCPFunction.setnRCellCU(nRCellCUList); + gNBCUCPFunctionList.add(gNBCUCPFunction); + } + } + nearRTRIC.setgNBCUCPFunction(gNBCUCPFunctionList); */ nearRTRIC.setgNBDUFunction(gNBDUFunctionList); nearRTRIC.setgNBCUUPFunction(gNBCUUPFunctionList); nearRTRICList.add(nearRTRIC); 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 ecc76b3..f707369 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 @@ -29,9 +29,11 @@ import org.onap.ransim.rest.api.models.CellDetails; import org.onap.ransim.rest.api.models.CellNeighbor; 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.OperationLog; import org.onap.ransim.rest.api.repository.CellDetailsRepo; import org.onap.ransim.rest.api.repository.CellNeighborRepo; +import org.onap.ransim.rest.api.repository.NRCellCURepository; import org.onap.ransim.rest.api.repository.NeighborDetailsRepo; import org.onap.ransim.rest.api.repository.NetconfServersRepo; import org.onap.ransim.rest.api.repository.OperationLogRepo; @@ -47,6 +49,9 @@ public class RansimRepositoryService { CellDetailsRepo cellDetailsRepo; @Autowired + NRCellCURepository nRCellCURepo; + + @Autowired NetconfServersRepo netconfServersRepo; @Autowired @@ -73,6 +78,36 @@ public class RansimRepositoryService { return cellDetails; } + /** + * Method to retrieve cellCU details + * + * @param cellLocalId + * @return + */ + public NRCellCU getNRCellCUDetail(Integer cellLocalId) { + Optional<NRCellCU> cd = nRCellCURepo.findById(cellLocalId); + NRCellCU nrCellCU = null; + if (cd.isPresent()) { + nrCellCU = cd.get(); + } + return nrCellCU; + } + + /** + * Method to retrieve cellCU neighbors + * + * @param cellLocalId + * @return + */ + public NRCellCU getCellRelation(Integer cellLocalId) { + Optional<NRCellCU> cellNeighborDetails = nRCellCURepo.findById(cellLocalId); + NRCellCU cellRelation = null; + if (cellNeighborDetails.isPresent()) { + cellRelation = cellNeighborDetails.get(); + } + return cellRelation; + } + /** * Method to retrieve netconf server details * |