diff options
author | yashwanth <gandhapu.yashwanth@wipro.com> | 2022-05-06 11:56:39 +0000 |
---|---|---|
committer | yashwanth <gandhapu.yashwanth@wipro.com> | 2022-05-06 12:28:50 +0000 |
commit | cfc1f962ac684f972be0b177d531088ca3ecd0ca (patch) | |
tree | fedf8fb0c20d3098b42b9e00ee25ea9f1b6ac142 /ransim/ransimctrlr/RANSIM-CTRLR/src | |
parent | 292aa06f9fc6a48652411087b4fc34b9ab728f2b (diff) |
Modify ANR Ransim Update
Issue-ID: INT-2107
Signed-off-by: yashwanth <gandhapu.yashwanth@wipro.com>
Change-Id: Ieebb957579ab09b70bff3b7beeeb148c8972b52b
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-CTRLR/src')
9 files changed, 373 insertions, 342 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 48d78c5..1b57776 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 @@ -178,15 +178,13 @@ public class RansimPciHandler { 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); + nbrList.addAll(ransimRepo.getNRCellRelationList(neighborList)); } for (int i = 0; i < nbrList.size(); i++) { 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 index 7e8f6ed..9a4f70d 100644 --- 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 @@ -20,11 +20,18 @@ package org.onap.ransim.rest.api.repository; + import java.util.Optional; + import java.util.List; + import org.onap.ransim.rest.api.models.NRCellRelation; + import org.onap.ransim.rest.api.models.NRCellCU; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface NRCellRelationRepository extends CrudRepository<NRCellRelation, Integer>{ - } + public Optional<NRCellRelation> findByIdNRCellRelationAndCellLocalId(Integer idNRCellRelation, NRCellCU cellLocalId); + + public List<NRCellRelation> findByCellLocalId(NRCellCU cellLocalId); + } 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 3e1e2a9..7aad13a 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 @@ -58,6 +58,7 @@ 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.NRCellRelation; import org.onap.ransim.rest.api.models.PLMNInfo; import org.onap.ransim.rest.api.models.RRMPolicyMember; import org.onap.ransim.rest.api.models.RRMPolicyRatio; @@ -87,7 +88,6 @@ 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; import org.onap.ransim.websocket.model.SNSSAI; import org.onap.ransim.websocket.model.SetConfigTopology; @@ -466,7 +466,7 @@ public class RansimControllerServices { for (NRCellCUModel nRCellCUModel : gNBCUCPModel.getCellCUList()) { 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/ransimdata.json")) { + try (FileReader reader = new FileReader("/tmp/ransim-install/config/ran-data.json")) { // Read JSON file Object obj = jsonParser.parse(reader); JSONArray List = (JSONArray) obj; @@ -1126,7 +1126,7 @@ public class RansimControllerServices { List<NRCellDU> nRCellDUList = new ArrayList<>(); for (NRCellDUModel nRCellDUModel : gNBDUModel.getCellDUList()) { NRCellDU nRCellDU = new NRCellDU(); - Attributes nRCellDUattributes = new Attributes(); + DUAttributes nRCellDUattributes = new DUAttributes(); nRCellDUattributes.setOperationalState(nRCellDUModel.getOperationalState()); nRCellDUattributes.setCellState(nRCellDUModel.getCellState()); nRCellDU.setAttributes(nRCellDUattributes); @@ -1224,9 +1224,9 @@ public class RansimControllerServices { nbr.setIdNRCellRelation(nbrCell.getNodeId()); nbr.setNRTCI(nbrCell.getPhysicalCellId()); nbr.setIdGNBCUCPFunction(nbrCell.getServerId()); - nbr.setServerId(nbrCell.getServerId()); + nbr.setServerId(nbrCell.getServerId()); nbr.setPlmnId(nbrCell.getNetworkId()); - nbr.setIsHOAllowed(cellDetails.isBlacklisted()); + nbr.setIsHOAllowed(cellDetails.isBlacklisted()); nbrList.add(nbr); } cell.setNeighborList(nbrList); @@ -1272,14 +1272,21 @@ public class RansimControllerServices { */ public void handleModifyPciFromSdnr(String message, Session session, String ipPort) { log.info("handleModifyPciFromSDNR: message:" + message + " session:" + session + " ipPort:" + ipPort); - ModifyPci modifyPci = new Gson().fromJson(message, ModifyPci.class); - log.info("handleModifyPciFromSDNR: modifyPci:" + modifyPci.getIdNRCellDU() + "; pci: " + modifyPci.getNRPCI()); - String source = "Netconf"; - CellDetails cd = ransimRepo.getCellDetail(modifyPci.getIdNRCellDU()); - long pci = cd.getPhysicalCellId(); - cd.setPhysicalCellId(modifyPci.getNRPCI()); - ransimRepo.mergeCellDetails(cd); - rsPciHdlr.updatePciOperationsTable(modifyPci.getIdNRCellDU(), source, pci, modifyPci.getNRPCI()); + NRCellDU modifyPci = new Gson().fromJson(message, NRCellDU.class); + log.info("handleModifyPciFromSDNR: modifyPci:" + modifyPci.getIdNRCellDU() + "; pci: " + modifyPci.getAttributes().getNRPCI()); + String source = "Netconf"; + int cellLocalId = Integer.parseInt(modifyPci.getIdNRCellDU()); + org.onap.ransim.rest.api.models.NRCellDU nrCellDU = ransimRepo.getNRCellDUDetail(cellLocalId); + //CellDetails cd = ransimRepo.getCellDetail(modifyPci.getIdNRCellDU()); + log.info("NRCellDU: " + nrCellDU); + int nRPCI = nrCellDU.getnRPCI(); + nrCellDU.setnRPCI(modifyPci.getAttributes().getNRPCI()); + ransimRepo.mergeNRCellDU(nrCellDU); + long pci = Long.valueOf(nRPCI); + //long pci = cd.getPhysicalCellId(); + //cd.setPhysicalCellId(modifyPci.getAttributes().getNRPCI()); + //ransimRepo.mergeCellDetails(cd); + rsPciHdlr.updatePciOperationsTable(modifyPci.getIdNRCellDU(), source, pci, modifyPci.getAttributes().getNRPCI()); } public void handleRTRICConfigFromSdnr(String message, Session session, String ipPort) { @@ -1558,48 +1565,39 @@ public class RansimControllerServices { public void handleModifyNeighborFromSdnr(String message, Session session, String ipPort) { log.info("handleModifyAnrFromSDNR: message:" + message + " session:" + session + " ipPort:" + ipPort); ModifyNeighbor modifyNeighbor = new Gson().fromJson(message, ModifyNeighbor.class); - log.info("handleModifyAnrFromSDNR: modifyPci:" + modifyNeighbor.getIdNRCellCU()); - List<NeighborDetails> neighborList = new ArrayList<NeighborDetails>(); + log.info("handleModifyAnrFromSDNR: modifyNeighbor:" + modifyNeighbor.getIdNRCellCU()); + Integer cellLocalId = Integer.parseInt(modifyNeighbor.getIdNRCellCU()); + Integer idNRCellRel = Integer.parseInt(modifyNeighbor.getIdNRCellRelation()); + org.onap.ransim.rest.api.models.NRCellCU nrCellCU = ransimRepo.getNRCellCUDetail(cellLocalId); + NRCellRelation nRCellRel = new NRCellRelation(); + nRCellRel.setIdNRCellRelation(idNRCellRel); + nRCellRel.setnRTCI(modifyNeighbor.getAttributes().getNRTCI()); + nRCellRel.setisHOAllowed(modifyNeighbor.getAttributes().getIsHOAllowed()); + nRCellRel.setCellLocalId(nrCellCU); List<String> cellList = new ArrayList<String>(); cellList.add(modifyNeighbor.getIdNRCellCU()); + cellList.add(modifyNeighbor.getIdNRCellRelation()); String nbrsAdd = ""; String nbrsDel = ""; String source = "Netconf"; - for (int i = 0; i < modifyNeighbor.getNeighborList().size(); i++) { - if (!modifyNeighbor.getNeighborList().get(i).getIsHOAllowed()) { - NeighborDetails nd = new NeighborDetails( - new NeihborId(modifyNeighbor.getIdNRCellCU(), modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation()), - true); - ransimRepo.mergeNeighborDetails(nd); - cellList.add(modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation()); - if (nbrsAdd.equals("")) { - nbrsDel = modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation(); - } else { - nbrsDel += "," + modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation(); - } - } else { - NeighborDetails nd = new NeighborDetails( - new NeihborId(modifyNeighbor.getIdNRCellCU(), modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation()), - false); - ransimRepo.mergeNeighborDetails(nd); - cellList.add(modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation()); - if (nbrsDel.equals("")) { - nbrsAdd = modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation(); - } else { - nbrsAdd += "," + modifyNeighbor.getNeighborList().get(i).getIdNRCellRelation(); - } - } - - } + NRCellRelation nRCellRel1 = ransimRepo.getNRCellRelation(idNRCellRel,nrCellCU); + if(nRCellRel1!=null){ + nRCellRel1.setisHOAllowed(modifyNeighbor.getAttributes().getIsHOAllowed()); + ransimRepo.mergeNRCellRel(nRCellRel1); + if(!modifyNeighbor.getAttributes().getIsHOAllowed()) { + nbrsDel = modifyNeighbor.getIdNRCellRelation(); + } + } else { + nbrsAdd = modifyNeighbor.getIdNRCellRelation(); + ransimRepo.mergeNRCellRel(nRCellRel); + } for (String cl : cellList) { rsPciHdlr.setCollisionConfusionFromFile(cl); } - log.info("neighbor list: " + neighborList); - - rsPciHdlr.updateNbrsOperationsTable(modifyNeighbor.getIdNRCellCU(), source, nbrsAdd, nbrsDel); + rsPciHdlr.updateNbrsOperationsTable(modifyNeighbor.getIdNRCellCU(), source, nbrsAdd, nbrsDel); } /** @@ -1621,7 +1619,7 @@ public class RansimControllerServices { Neighbor nbr = new Neighbor(); CellDetails nbrCell = ransimRepo.getCellDetail(nbCell.getNeigbor().getNeighborCell()); - nbr.setIdNRCellRelation(nbrCell.getNodeId()); + nbr.setIdNRCellRelation(nbrCell.getNodeId()); nbr.setNRTCI(nbrCell.getPhysicalCellId()); nbr.setIdGNBCUCPFunction(nbrCell.getNodeName()); nbr.setServerId(nbrCell.getServerId()); 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 f707369..8a6713b 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 @@ -30,10 +30,14 @@ 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.NRCellDU; +import org.onap.ransim.rest.api.models.NRCellRelation; 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.NRCellDURepository; +import org.onap.ransim.rest.api.repository.NRCellRelationRepository; import org.onap.ransim.rest.api.repository.NeighborDetailsRepo; import org.onap.ransim.rest.api.repository.NetconfServersRepo; import org.onap.ransim.rest.api.repository.OperationLogRepo; @@ -52,6 +56,12 @@ public class RansimRepositoryService { NRCellCURepository nRCellCURepo; @Autowired + NRCellDURepository nRCellDURepo; + + @Autowired + NRCellRelationRepository nRCellRelRepo; + + @Autowired NetconfServersRepo netconfServersRepo; @Autowired @@ -79,6 +89,21 @@ public class RansimRepositoryService { } /** + * Method to retrieve cellDU details + * + * @param cellLocalId + * @return + */ + public NRCellDU getNRCellDUDetail(Integer cellLocalId) { + Optional<NRCellDU> cd = nRCellDURepo.findById(cellLocalId); + NRCellDU nrCellDU = null; + if (cd.isPresent()) { + nrCellDU = cd.get(); + } + return nrCellDU; + } + + /** * Method to retrieve cellCU details * * @param cellLocalId @@ -93,189 +118,234 @@ public class RansimRepositoryService { return nrCellCU; } - /** - * Method to retrieve cellCU neighbors + /** + * Method to retrieve cellCU details * + * @param idNRCellRelation * @param cellLocalId * @return */ - public NRCellCU getCellRelation(Integer cellLocalId) { - Optional<NRCellCU> cellNeighborDetails = nRCellCURepo.findById(cellLocalId); - NRCellCU cellRelation = null; - if (cellNeighborDetails.isPresent()) { - cellRelation = cellNeighborDetails.get(); + public NRCellRelation getNRCellRelation(Integer idNRCellRelation, NRCellCU cellLocalId) { + Optional<NRCellRelation> rel = nRCellRelRepo.findByIdNRCellRelationAndCellLocalId(idNRCellRelation,cellLocalId); + NRCellRelation nRCellRel = null; + if (rel.isPresent()) { + nRCellRel = rel.get(); } - return cellRelation; - } - - /** - * Method to retrieve netconf server details - * - * @param serverId - * @return - */ - public NetconfServers getNetconfServer(String serverId) { - Optional<NetconfServers> serverDetails = netconfServersRepo.findById(serverId); - NetconfServers server = null; - if (serverDetails.isPresent()) { - server = serverDetails.get(); - } - return server; + return nRCellRel; } /** - * Method to retrieve cell neighbors - * - * @param nodeId - * @return - */ - public CellNeighbor getCellNeighbor(String nodeId) { - Optional<CellNeighbor> cellNeighborDetails = cellNeighborRepo.findById(nodeId); - CellNeighbor cellNeighbor = null; - if (cellNeighborDetails.isPresent()) { - cellNeighbor = cellNeighborDetails.get(); - } - return cellNeighbor; - } - - /** - * Method to retrieve all cell details - * - * @return - */ - public List<CellDetails> getCellDetailsList() { - Iterable<CellDetails> cellsList = cellDetailsRepo.findAll(); - if (cellsList != null) { - return (List<CellDetails>) cellsList; - } else { - return new ArrayList<>(); - } - } - - /** - * Method to retrieve cells with no server ids - * - * @return - */ - public List<CellDetails> getCellsWithNoServerIds() { - List<CellDetails> cellsList = cellDetailsRepo.findCellsWithNoServerId(); - if (cellsList != null) { - return cellsList; - } else { - return new ArrayList<>(); - } - } - - /** - * Method to retrieve cell with collision or confusion - * - * @return - */ - public List<CellDetails> getCellsWithCollisionOrConfusion() { - List<CellDetails> cellsList = cellDetailsRepo.getCellsWithCollisionOrConfusion(); - if (cellsList != null) { - return cellsList; - } else { - return new ArrayList<>(); - } - } - - /** - * Method to retrieve operation log - * - * @return - */ - public List<OperationLog> getOperationLogList() { - Iterable<OperationLog> opLogList = operationLogRepo.findAll(); - if (opLogList != null) { - return (List<OperationLog>) opLogList; - } else { - return new ArrayList<>(); - } - } - - /** - * Method to retrieve all netconf servers - * - * @return - */ - public List<NetconfServers> getNetconfServersList() { - Iterable<NetconfServers> serversList = netconfServersRepo.findAll(); - if (serversList != null) { - return (List<NetconfServers>) serversList; - } else { - return new ArrayList<>(); - } - } - - /** - * Method to retrieve all cell neighbors - * - * @return - */ - public List<CellNeighbor> getCellNeighborList() { - Iterable<CellNeighbor> cellNeighborList = cellNeighborRepo.findAll(); - if (cellNeighborList != null) { - return (List<CellNeighbor>) cellNeighborList; - } else { - return new ArrayList<>(); - } - } - - /** - * Method to delete specific cells - * - * @param deleteCelldetail - */ - public void deleteCellDetails(CellDetails deleteCelldetail) { - - if (deleteCelldetail.getServerId() != null) { - NetconfServers ns = getNetconfServer(deleteCelldetail.getServerId()); - if (ns != null) { - ns.getCells().remove(deleteCelldetail); - netconfServersRepo.save(ns); - } - } - cellDetailsRepo.deleteById(deleteCelldetail.getNodeId()); - } - - /** - * Method to delete cell neighbors - * - * @param deleteCellNeighbor - */ - public void deleteCellNeighbor(CellNeighbor deleteCellNeighbor) { - cellNeighborRepo.deleteById(deleteCellNeighbor.getNodeId()); - } - - /** - * Method to delete all netconf servers - */ - public void deleteNetconfServers() { - netconfServersRepo.deleteAll(); - } - - /** - * Method to delete all cell neighbors - */ - public void deleteCellNeighbors() { - cellNeighborRepo.deleteAll(); + * Method to retrieve cellCU details + * + * @param cellLocalId + * @return + */ + public List<NRCellRelation> getNRCellRelationList(NRCellCU cellLocalId) { + List<NRCellRelation> rel = nRCellRelRepo.findByCellLocalId(cellLocalId); + return rel; } - /** - * Method to delete all cells - */ - public void deleteAllCellDetails() { - cellDetailsRepo.deleteAll(); + /** + * 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 + * + * @param serverId + * @return + */ + public NetconfServers getNetconfServer(String serverId) { + Optional<NetconfServers> serverDetails = netconfServersRepo.findById(serverId); + NetconfServers server = null; + if (serverDetails.isPresent()) { + server = serverDetails.get(); + } + return server; + } + + /** + * Method to retrieve cell neighbors + * + * @param nodeId + * @return + */ + public CellNeighbor getCellNeighbor(String nodeId) { + Optional<CellNeighbor> cellNeighborDetails = cellNeighborRepo.findById(nodeId); + CellNeighbor cellNeighbor = null; + if (cellNeighborDetails.isPresent()) { + cellNeighbor = cellNeighborDetails.get(); + } + return cellNeighbor; + } + + /** + * Method to retrieve all cell details + * + * @return + */ + public List<CellDetails> getCellDetailsList() { + Iterable<CellDetails> cellsList = cellDetailsRepo.findAll(); + if (cellsList != null) { + return (List<CellDetails>) cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve cells with no server ids + * + * @return + */ + public List<CellDetails> getCellsWithNoServerIds() { + List<CellDetails> cellsList = cellDetailsRepo.findCellsWithNoServerId(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve cell with collision or confusion + * + * @return + */ + public List<CellDetails> getCellsWithCollisionOrConfusion() { + List<CellDetails> cellsList = cellDetailsRepo.getCellsWithCollisionOrConfusion(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve operation log + * + * @return + */ + public List<OperationLog> getOperationLogList() { + Iterable<OperationLog> opLogList = operationLogRepo.findAll(); + if (opLogList != null) { + return (List<OperationLog>) opLogList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve all netconf servers + * + * @return + */ + public List<NetconfServers> getNetconfServersList() { + Iterable<NetconfServers> serversList = netconfServersRepo.findAll(); + if (serversList != null) { + return (List<NetconfServers>) serversList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve all cell neighbors + * + * @return + */ + public List<CellNeighbor> getCellNeighborList() { + Iterable<CellNeighbor> cellNeighborList = cellNeighborRepo.findAll(); + if (cellNeighborList != null) { + return (List<CellNeighbor>) cellNeighborList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to delete specific cells + * + * @param deleteCelldetail + */ + public void deleteCellDetails(CellDetails deleteCelldetail) { + + if (deleteCelldetail.getServerId() != null) { + NetconfServers ns = getNetconfServer(deleteCelldetail.getServerId()); + if (ns != null) { + ns.getCells().remove(deleteCelldetail); + netconfServersRepo.save(ns); + } + } + cellDetailsRepo.deleteById(deleteCelldetail.getNodeId()); + } + + /** + * Method to delete cell neighbors + * + * @param deleteCellNeighbor + */ + public void deleteCellNeighbor(CellNeighbor deleteCellNeighbor) { + cellNeighborRepo.deleteById(deleteCellNeighbor.getNodeId()); + } + + /** + * Method to delete all netconf servers + */ + public void deleteNetconfServers() { + netconfServersRepo.deleteAll(); + } + + /** + * Method to delete all cell neighbors + */ + public void deleteCellNeighbors() { + cellNeighborRepo.deleteAll(); + } + + /** + * Method to delete all cells + */ + public void deleteAllCellDetails() { + cellDetailsRepo.deleteAll(); + } + + /** + * Method to save cells + * + * @param cellDetail + */ + public void mergeCellDetails(CellDetails cellDetail) { + cellDetailsRepo.save(cellDetail); + } + + /** + * Method to save cells + * + * @param nRCellRelation + */ + public void mergeNRCellRel(NRCellRelation nRCellRel) { + nRCellRelRepo.save(nRCellRel); } /** * Method to save cells - * - * @param cellDetail + * + * @param nRCellDU */ - public void mergeCellDetails(CellDetails cellDetail) { - cellDetailsRepo.save(cellDetail); + public void mergeNRCellDU(NRCellDU nRCellDU) { + nRCellDURepo.save(nRCellDU); } /** diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AttributesNRRelation.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AttributesNRRelation.java index 791c78d..3118a32 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AttributesNRRelation.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AttributesNRRelation.java @@ -29,6 +29,7 @@ private Integer nRTCI; private boolean isHOAllowed; + @JsonProperty("nRTCI") public Integer getNRTCI() { return nRTCI; } @@ -37,6 +38,7 @@ this.nRTCI = nRTCI; } + @JsonProperty("isHOAllowed") public boolean getIsHOAllowed() { return isHOAllowed; } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DUAttributes.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DUAttributes.java new file mode 100755 index 0000000..68a7f4a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DUAttributes.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 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. + * 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. + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DUAttributes { + + private int nRPCI; + private String operationalState; + private String cellState; + + @JsonProperty("nRPCI") + public int getNRPCI() { + return nRPCI; + } + + public void setNRPCI(int nRPCI) { + this.nRPCI = nRPCI; + } + + public String getOperationalState() { + return operationalState; + } + + public void setOperationalState(String operationalState) { + this.operationalState = operationalState; + } + + public String getCellState() { + return cellState; + } + + public void setCellState(String cellState) { + this.cellState = cellState; + } + + public DUAttributes() { + + } + + public DUAttributes(int nRPCI) { + super(); + this.nRPCI = nRPCI; + } + + @Override + public String toString() { + return "Attributes [ nRPCI=" + nRPCI + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java index cb5f330..e1f1923 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java @@ -24,17 +24,9 @@ import java.util.List; public class ModifyNeighbor { - private String idGNBCUCPFunction; private String idNRCellCU; - private List<NeighborHo> neighborList; - - public String getIdGNBCUCPFunction() { - return idGNBCUCPFunction; - } - - public void setIdGNBCUCPFunction(String idGNBCUCPFunction) { - this.idGNBCUCPFunction = idGNBCUCPFunction; - } + private String idNRCellRelation; + private AttributesNRRelation attributes; public String getIdNRCellCU() { return idNRCellCU; @@ -44,12 +36,16 @@ public class ModifyNeighbor { this.idNRCellCU = idNRCellCU; } - public List<NeighborHo> getNeighborList() { - return neighborList; + public String getIdNRCellRelation(){ return idNRCellRelation; } + + public void setIdNRCellRelation(String idNRCellRelation){ this.idNRCellRelation = idNRCellRelation; } + + public AttributesNRRelation getAttributes() { + return attributes; } - public void setNeighborList(List<NeighborHo> neighborList) { - this.neighborList = neighborList; + public void setAttributes(AttributesNRRelation attributes) { + this.attributes = attributes; } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java deleted file mode 100644 index 7ef8707..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java +++ /dev/null @@ -1,107 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2020 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.websocket.model; - -import java.util.List; - -public class ModifyPci { - - private String idGNBDUFunction; - - private long nRPCI; - - private String idNRCellDU; - - private List<Neighbor> neighborList; - - public long getNRPCI() { - return nRPCI; - } - - public void setNRPCI(long nRPCI) { - this.nRPCI = nRPCI; - } - - public String getIdNRCellDU() { - return idNRCellDU; - } - - public void setIdNRCellDU(String idNRCellDU) { - this.idNRCellDU = idNRCellDU; - } - - @Override - public String toString() { - return "ModifyPci [idGNBDUFunction = " + idGNBDUFunction + ", nRPCI = " + nRPCI + ", idNRCellDU = " + idNRCellDU + "neighborList:" - + neighborList + "]"; - } - - public ModifyPci() { - } - - /** - * Modify Pci value from sdnr. - * - * @param idGNBDUFunction server id name - * @param nRPCI pci number - * @param idNRCellDU node id for the cell - * @param neighborList neighbor list for the cell - */ - public ModifyPci(String idGNBDUFunction, long nRPCI, String idNRCellDU, List<Neighbor> neighborList) { - super(); - this.idGNBDUFunction = idGNBDUFunction; - this.nRPCI = nRPCI; - this.idNRCellDU = idNRCellDU; - this.neighborList = neighborList; - } - - public String getIdGNBDUFunction() { - return idGNBDUFunction; - } - - public void setIdGNBDUFunction(String idGNBDUFunction) { - this.idGNBDUFunction = idGNBDUFunction; - } - - public List<Neighbor> getNeighborList() { - return neighborList; - } - - public void setNeighborList(List<Neighbor> neighborList) { - this.neighborList = neighborList; - } - - /** - * Checks if all the parameters are set correctly . - * - * @return returns true if the parameter are set correctly - */ - public boolean isAllSet() { - if (idGNBDUFunction == null || idGNBDUFunction.trim().equals("")) { - return false; - } - if (idNRCellDU == null || idNRCellDU.trim().equals("")) { - return false; - } - return true; - } - -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java index bc6003f..2e46cd9 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java @@ -27,7 +27,7 @@ public class NRCellDU { private String idNRCellDU; - private Attributes attributes; + private DUAttributes attributes; public String getIdNRCellDU() { return idNRCellDU; @@ -37,15 +37,15 @@ public class NRCellDU { this.idNRCellDU = idNRCellDU; } - public Attributes getAttributes() { + public DUAttributes getAttributes() { return attributes; } - public void setAttributes(Attributes attributes) { + public void setAttributes(DUAttributes attributes) { this.attributes = attributes; } - public NRCellDU(Attributes attributes) { + public NRCellDU(DUAttributes attributes) { super(); this.attributes = attributes; } |