From 49f60702c82398abadb0bc28bf9a3b902b1deee7 Mon Sep 17 00:00:00 2001 From: deepikasatheesh Date: Thu, 4 Feb 2021 14:54:53 +0000 Subject: Refactored & enhanced code check-in RANSim Controller and RANSim GUI Issue-ID: INT-1849 Signed-off-by: deepikasatheesh Change-Id: I8f92d8eae6eb67708098ccd696dbfff0eaa5f87f --- ransim/WebContent/META-INF/MANIFEST.MF | 3 + ransim/docker/.env | 2 - ransim/docker/config/db/db.sh | 0 ransim/docker/config/db/ransim_schema.sql | 369 +++++ ransim/docker/config/ransim/gNBCUConfig.json | 772 ++++++++++ .../docker/config/ransim/gNBCUConfig_1NSSAI.json | 472 ++++++ ransim/docker/config/ransim/jssecacerts | Bin 0 -> 161770 bytes ransim/docker/config/ransim/ransim.properties | 5 - ransim/docker/docker-compose.yml | 10 +- ransim/docker/ransim-docker/Dockerfile | 35 +- ransim/docker/ransim-docker/do-start.sh | 0 ransim/docker/ransim-docker/docker-install.sh | 0 ransim/docker/ransim-docker/wait-for-port.sh | 0 ransim/pom.xml | 7 +- ransim/ransimctrlr/RANSIM-CTRLR/.gitignore | 1 + ransim/ransimctrlr/RANSIM-CTRLR/pom.xml | 147 +- .../src/main/java/org/onap/ransim/Application.java | 17 + .../main/java/org/onap/ransim/RansimDbConfig.java | 74 + .../java/org/onap/ransim/ServletInitializer.java | 13 + .../org/onap/ransim/netconf/NetconfClient.java | 226 +++ .../ransim/rest/api/controller/FileController.java | 90 ++ .../api/controller/RANSliceConfigController.java | 567 ++++++++ .../rest/api/controller/RansimController.java | 1525 ++++++++----------- .../api/controller/RansimControllerDatabase.java | 409 ------ .../api/controller/RansimControllerServices.java | 730 ---------- .../rest/api/controller/RansimPciHandler.java | 1011 ------------- .../rest/api/exceptions/RansimException.java | 27 + .../ransim/rest/api/handler/RansimPciHandler.java | 963 ++++++++++++ .../rest/api/handler/RansimSlicingHandler.java | 265 ++++ .../org/onap/ransim/rest/api/models/CellData.java | 74 +- .../onap/ransim/rest/api/models/CellDetails.java | 465 +++--- .../org/onap/ransim/rest/api/models/CellInfo.java | 191 ++- .../onap/ransim/rest/api/models/CellNeighbor.java | 106 +- .../onap/ransim/rest/api/models/ConfigData.java | 21 + .../ransim/rest/api/models/CreateACellReq.java | 105 +- .../ransim/rest/api/models/DeleteACellReq.java | 51 +- .../onap/ransim/rest/api/models/FmAlarmInfo.java | 97 +- .../ransim/rest/api/models/GNBCUCPFunction.java | 79 + .../ransim/rest/api/models/GNBCUUPFunction.java | 79 + .../onap/ransim/rest/api/models/GNBDUFunction.java | 86 ++ .../ransim/rest/api/models/GetACellDetailReq.java | 51 +- .../ransim/rest/api/models/GetNeighborList.java | 98 +- .../ransim/rest/api/models/GetNeighborListReq.java | 51 +- .../api/models/GetNetconfServerDetailsReq.java | 53 +- .../onap/ransim/rest/api/models/GetPmDataReq.java | 74 +- .../onap/ransim/rest/api/models/GetTopology.java | 144 +- .../ransim/rest/api/models/ModifyACellReq.java | 101 +- .../org/onap/ransim/rest/api/models/NRCellCU.java | 58 + .../org/onap/ransim/rest/api/models/NRCellDU.java | 98 ++ .../onap/ransim/rest/api/models/NSSAIConfig.java | 45 + .../org/onap/ransim/rest/api/models/NbrDump.java | 62 +- .../org/onap/ransim/rest/api/models/NearRTRIC.java | 96 ++ .../ransim/rest/api/models/NeighborDetails.java | 56 +- .../ransim/rest/api/models/NeighborPmDetails.java | 82 +- .../org/onap/ransim/rest/api/models/NeihborId.java | 125 +- .../ransim/rest/api/models/NetconfServers.java | 133 +- .../onap/ransim/rest/api/models/OperationLog.java | 128 +- .../org/onap/ransim/rest/api/models/PLMNInfo.java | 43 + .../onap/ransim/rest/api/models/PLMNInfoModel.java | 115 ++ .../onap/ransim/rest/api/models/PmDataDump.java | 42 +- .../onap/ransim/rest/api/models/PmParameters.java | 135 +- .../onap/ransim/rest/api/models/RANSliceInfo.java | 101 ++ .../ransim/rest/api/models/RRMPolicyMember.java | 41 + .../ransim/rest/api/models/RRMPolicyRatio.java | 91 ++ .../org/onap/ransim/rest/api/models/SNSSAI.java | 68 + .../ransim/rest/api/models/SetCollisionReq.java | 47 +- .../onap/ransim/rest/api/models/SetConstants.java | 168 ++- .../onap/ransim/rest/api/models/SliceProfile.java | 130 ++ .../org/onap/ransim/rest/api/models/TACells.java | 36 + .../org/onap/ransim/rest/api/models/Topology.java | 164 +-- .../onap/ransim/rest/api/models/TopologyDump.java | 35 +- .../rest/api/repository/CellDetailsRepo.java | 37 + .../rest/api/repository/CellNeighborRepo.java | 29 + .../rest/api/repository/GNBCUCPRepository.java | 17 + .../rest/api/repository/GNBCUUPRepository.java | 10 + .../rest/api/repository/GNBDURepository.java | 14 + .../rest/api/repository/NRCellCURepository.java | 10 + .../rest/api/repository/NRCellDURepository.java | 8 + .../rest/api/repository/NearRTRICRepository.java | 24 + .../rest/api/repository/NeighborDetailsRepo.java | 29 + .../rest/api/repository/NetconfServersRepo.java | 29 + .../rest/api/repository/OperationLogRepo.java | 29 + .../api/repository/RANInventoryRepository.java | 13 + .../api/repository/RRMPolicyMemberRepository.java | 31 + .../rest/api/repository/RRMPolicyRepository.java | 15 + .../api/repository/SliceProfileRepository.java | 9 + .../rest/api/repository/TACellRepository.java | 15 + .../rest/api/services/RANSliceConfigService.java | 614 ++++++++ .../api/services/RansimControllerServices.java | 1527 ++++++++++++++++++++ .../rest/api/services/RansimRepositoryService.java | 244 ++++ .../rest/api/services/SlicingPMDataGenerator.java | 282 ++++ .../org/onap/ransim/rest/client/RestClient.java | 169 ++- .../onap/ransim/rest/config/RansimRestConfig.java | 90 +- .../ransim/rest/config/RansimRestInitializer.java | 49 - .../org/onap/ransim/rest/web/mapper/CellData.java | 101 ++ .../ransim/rest/web/mapper/CellInputPayload.java | 24 + .../rest/web/mapper/CellNbrInfoResponse.java | 57 + .../org/onap/ransim/rest/web/mapper/CellObj.java | 33 + .../ransim/rest/web/mapper/CellPciValueObj.java | 33 + .../org/onap/ransim/rest/web/mapper/ErrorData.java | 30 + .../onap/ransim/rest/web/mapper/GNBCUCPModel.java | 62 + .../onap/ransim/rest/web/mapper/GNBCUUPModel.java | 72 + .../onap/ransim/rest/web/mapper/GNBDUModel.java | 70 + .../onap/ransim/rest/web/mapper/NRCellCUModel.java | 32 + .../onap/ransim/rest/web/mapper/NRCellDUModel.java | 83 ++ .../ransim/rest/web/mapper/NSSAIConfigData.java | 37 + .../org/onap/ransim/rest/web/mapper/NSSAIData.java | 43 + .../ransim/rest/web/mapper/NbrCellsNetwork.java | 38 + .../rest/web/mapper/NbrCellsNetworkResponse.java | 41 + .../org/onap/ransim/rest/web/mapper/NbrList.java | 38 + .../ransim/rest/web/mapper/NbrListResponse.java | 29 + .../org/onap/ransim/rest/web/mapper/NbrObj.java | 27 + .../ransim/rest/web/mapper/NearRTRICModel.java | 77 + .../onap/ransim/rest/web/mapper/PLMNInfoModel.java | 24 + .../ransim/rest/web/mapper/RANSliceInfoModel.java | 79 + .../rest/web/mapper/RRMPolicyMemberModel.java | 23 + .../rest/web/mapper/RRMPolicyRatioModel.java | 77 + .../org/onap/ransim/rest/web/mapper/Result.java | 40 + .../ransim/rest/web/mapper/SliceProfileModel.java | 92 ++ .../onap/ransim/rest/xml/models/FileFooter.java | 42 + .../onap/ransim/rest/xml/models/FileHeader.java | 79 + .../onap/ransim/rest/xml/models/FileSender.java | 53 + .../ransim/rest/xml/models/GranularityPeriod.java | 56 + .../java/org/onap/ransim/rest/xml/models/Job.java | 49 + .../ransim/rest/xml/models/ManagedElement.java | 65 + .../onap/ransim/rest/xml/models/MeasCollec.java | 46 + .../onap/ransim/rest/xml/models/MeasCollecEnd.java | 19 + .../ransim/rest/xml/models/MeasCollecFile.java | 68 + .../org/onap/ransim/rest/xml/models/MeasData.java | 51 + .../org/onap/ransim/rest/xml/models/MeasInfo.java | 112 ++ .../onap/ransim/rest/xml/models/MeasResult.java | 34 + .../org/onap/ransim/rest/xml/models/MeasType.java | 55 + .../org/onap/ransim/rest/xml/models/MeasValue.java | 63 + .../ransim/rest/xml/models/ReportingPeriod.java | 47 + .../org/onap/ransim/rest/xml/models/Result.java | 54 + .../org/onap/ransim/utilities/RansimUtilities.java | 55 + .../websocket/model/AdditionalMeasurements.java | 43 +- .../onap/ransim/websocket/model/Attributes.java | 46 + .../websocket/model/CommonEventHeaderFm.java | 124 +- .../websocket/model/CommonEventHeaderPm.java | 76 +- .../onap/ransim/websocket/model/ConfigData.java | 33 + .../ransim/websocket/model/ConfigPLMNInfo.java | 38 + .../onap/ransim/websocket/model/DeviceData.java | 42 +- .../ransim/websocket/model/DeviceDataDecoder.java | 56 +- .../ransim/websocket/model/DeviceDataEncoder.java | 38 +- .../org/onap/ransim/websocket/model/EventFm.java | 62 +- .../org/onap/ransim/websocket/model/EventPm.java | 40 +- .../onap/ransim/websocket/model/FaultFields.java | 123 +- .../org/onap/ransim/websocket/model/FmMessage.java | 18 +- .../ransim/websocket/model/GNBCUUPFunction.java | 31 + .../onap/ransim/websocket/model/GNBDUFunction.java | 40 + .../onap/ransim/websocket/model/Measurement.java | 41 +- .../onap/ransim/websocket/model/MessageTypes.java | 24 +- .../ransim/websocket/model/ModifyNeighbor.java | 58 +- .../org/onap/ransim/websocket/model/ModifyPci.java | 163 +-- .../org/onap/ransim/websocket/model/NRCellDU.java | 32 + .../org/onap/ransim/websocket/model/NearRTRIC.java | 48 + .../org/onap/ransim/websocket/model/Neighbor.java | 127 +- .../onap/ransim/websocket/model/NeighborHo.java | 56 +- .../org/onap/ransim/websocket/model/PmMessage.java | 18 +- .../onap/ransim/websocket/model/RanNetwork.java | 47 + .../org/onap/ransim/websocket/model/SNSSAI.java | 31 + .../ransim/websocket/model/SetConfigTopology.java | 134 +- .../ransim/websocket/model/SlicingPmMessage.java | 83 ++ .../org/onap/ransim/websocket/model/Topology.java | 132 +- .../onap/ransim/websocket/model/UpdateCell.java | 94 +- .../websocket/server/RansimWebSocketServer.java | 392 ++--- .../src/main/resources/META-INF/persistence.xml | 43 - .../src/main/resources/application.properties | 8 + .../src/main/resources/dumpfileNames.properties | 1 + .../rest/api/controller/TestRansimController.java | 96 +- .../api/services/TestRANSliceConfigServices.java | 316 ++++ .../src/test/resources/hibernate.properties | 11 +- .../src/main/webapp/AdditionalFeature.html | 155 +- .../RANSIM-GUI/src/main/webapp/SimulationStop.html | 85 +- .../src/main/webapp/SimulationTrigger.html | 131 +- .../src/main/webapp/SimulationTriggerFile.html | 101 +- .../RANSIM-GUI/src/main/webapp/controlpanel.html | 74 +- .../RANSIM-GUI/src/main/webapp/deleteCell.html | 110 +- .../src/main/webapp/displayCellDetails.html | 138 +- .../RANSIM-GUI/src/main/webapp/getdump.html | 207 +-- .../RANSIM-GUI/src/main/webapp/honeycomb.html | 95 +- .../RANSIM-GUI/src/main/webapp/modifyCell.html | 143 +- .../RANSIM-GUI/src/main/webapp/modifyCellPci.html | 148 +- .../RANSIM-GUI/src/main/webapp/newmodify.html | 145 +- .../src/main/webapp/operationhistory.html | 67 +- .../RANSIM-GUI/src/main/webapp/ransim.html | 166 +-- .../RANSIM-GUI/src/main/webapp/ransimgrid.html | 158 +- .../RANSIM-GUI/src/main/webapp/startPm.html | 116 +- .../RANSIM-GUI/src/main/webapp/startsPm.html | 112 +- .../RANSIM-GUI/src/main/webapp/stopPm.html | 84 +- .../RANSIM-GUI/src/main/webapp/uploadFile.html | 13 + .../install/servers/common/tomcat/init.d/tomcatd | 0 ransim/ransimctrlr/pom.xml | 59 - 194 files changed, 15245 insertions(+), 7096 deletions(-) create mode 100644 ransim/WebContent/META-INF/MANIFEST.MF delete mode 100644 ransim/docker/.env mode change 100644 => 100755 ransim/docker/config/db/db.sh create mode 100644 ransim/docker/config/db/ransim_schema.sql create mode 100644 ransim/docker/config/ransim/gNBCUConfig.json create mode 100644 ransim/docker/config/ransim/gNBCUConfig_1NSSAI.json create mode 100644 ransim/docker/config/ransim/jssecacerts mode change 100644 => 100755 ransim/docker/ransim-docker/do-start.sh mode change 100644 => 100755 ransim/docker/ransim-docker/docker-install.sh mode change 100644 => 100755 ransim/docker/ransim-docker/wait-for-port.sh create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/Application.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/RansimDbConfig.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/ServletInitializer.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/FileController.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RANSliceConfigController.java delete mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerDatabase.java delete mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerServices.java delete mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimPciHandler.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ConfigData.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUCPFunction.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBDUFunction.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NSSAIConfig.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RANSliceInfo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyMember.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SNSSAI.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SliceProfile.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TACells.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellDetailsRepo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellNeighborRepo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUCPRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBDURepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellDURepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NearRTRICRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NeighborDetailsRepo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NetconfServersRepo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/OperationLogRepo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RANInventoryRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyMemberRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/SliceProfileRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/TACellRepository.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java delete mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestInitializer.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellData.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellInputPayload.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellNbrInfoResponse.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellObj.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellPciValueObj.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/ErrorData.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUCPModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUUPModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBDUModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellCUModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellDUModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIConfigData.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIData.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetwork.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetworkResponse.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrList.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrListResponse.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrObj.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NearRTRICModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/PLMNInfoModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RANSliceInfoModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyMemberModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyRatioModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/Result.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/SliceProfileModel.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileFooter.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileHeader.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileSender.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/GranularityPeriod.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Job.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ManagedElement.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollec.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecEnd.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecFile.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasData.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasInfo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasResult.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasType.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasValue.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ReportingPeriod.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Result.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/utilities/RansimUtilities.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Attributes.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigData.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigPLMNInfo.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBCUUPFunction.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBDUFunction.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NearRTRIC.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RanNetwork.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SNSSAI.java create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SlicingPmMessage.java delete mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/META-INF/persistence.xml create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/dumpfileNames.properties create mode 100644 ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/services/TestRANSliceConfigServices.java create mode 100644 ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/uploadFile.html mode change 100644 => 100755 ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd diff --git a/ransim/WebContent/META-INF/MANIFEST.MF b/ransim/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/ransim/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/ransim/docker/.env b/ransim/docker/.env deleted file mode 100644 index 0916ff2..0000000 --- a/ransim/docker/.env +++ /dev/null @@ -1,2 +0,0 @@ -PRELOAD_POLICIES=true - diff --git a/ransim/docker/config/db/db.sh b/ransim/docker/config/db/db.sh old mode 100644 new mode 100755 diff --git a/ransim/docker/config/db/ransim_schema.sql b/ransim/docker/config/db/ransim_schema.sql new file mode 100644 index 0000000..2212253 --- /dev/null +++ b/ransim/docker/config/db/ransim_schema.sql @@ -0,0 +1,369 @@ +CREATE USER 'uroot'@'%' IDENTIFIED BY 'psecret'; +CREATE SCHEMA IF NOT EXISTS `ransim_db` DEFAULT CHARACTER SET utf8 ; +USE `ransim_db` ; +grant all privileges on ransim_db.* TO 'uroot'@'%' identified by 'psecret'; +flush privileges; +drop table if exists nearrtric; +drop table if exists gnbcucpfunction; +drop table if exists gnbcuupfunction; +drop table if exists gnbdufunction; +drop table if exists nrcellcu; +drop table if exists nrcelldu; +drop table if exists raninventory; +drop table if exists rrmpolicyratio; +drop table if exists rrmpolicymember; +drop table if exists tacells; +drop table if exists sliceprofile; +drop table if exists plmninfo; +drop table if exists trackingarea; +drop table if exists rannfnssi; +drop table if exists nssai; +drop table if exists rannssi; + +-- ----------------------------------------------------- +-- Table `ransim_db`.`cell` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `ransim_db`.`cell`( + `cell_id` varchar(45) NOT NULL, + `last_modifiedts` datetime(6) NOT NULL, + `location` varchar(200) DEFAULT NULL, + `network_id` varchar(45) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `pci_value` bigint(20) NOT NULL, + `pnf_id` varchar(255) NOT NULL, + PRIMARY KEY (`cell_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `ransim_db`.`cell_nbr_info` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `ransim_db`.`cell_nbr_info`( + `cell_id` varchar(45) NOT NULL, + `target_cell_id` varchar(45) NOT NULL, + `ho` bit(1) NOT NULL, + PRIMARY KEY (`cell_id`,`target_cell_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- Guilin - Slicing Usecase +-- ----------------------------------------------------- +-- Table `ransim_db`.`nearrtric` +-- ----------------------------------------------------- +create table nearrtric ( + nearrtricid integer not null, + gnbid integer, + resourcetype varchar(255), + primary key (nearrtricid) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`trackingarea` +-- ----------------------------------------------------- +create table trackingarea ( + nearrtricid integer not null, + tracking_area varchar(255) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rannfnssi` +-- ----------------------------------------------------- + create table rannfnssi ( + nearrtricid integer not null, + rannfnssilist varchar(255) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`nssai` +-- ----------------------------------------------------- +create table nssai ( + rannfnssiid varchar(255) not null, + nssailist varchar(255) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`gnbcucpfunction` +-- ----------------------------------------------------- +create table gnbcucpfunction ( + gnbcuname varchar(255) not null, + gnbid integer, + gnbidlength integer, + nftype varchar(255), + plmnid varchar(255), + nearrtricid integer, + primary key (gnbcuname) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`gnbcuupfunction` +-- ----------------------------------------------------- +create table gnbcuupfunction ( + gnbcuupid integer not null, + gnbid integer, + gnbidlength integer, + resourcetype varchar(255), + nearrtricid integer, + primary key (gnbcuupid) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`gnbdufunction` +-- ----------------------------------------------------- +create table gnbdufunction ( + gnbduid integer not null, + gnbduname varchar(255), + gnbid integer, + gnbidlength integer, + nftype varchar(255), + plmnid varchar(255), + nearrtricid integer, + primary key (gnbduid) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`nrcellcu` +-- ----------------------------------------------------- +create table nrcellcu ( + celllocalid integer not null, + gnbcuname varchar(255), + resourcetype varchar(255), + primary key (celllocalid) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`nrcelldu` +-- ----------------------------------------------------- +create table nrcelldu ( + celllocalid integer not null, + administrativestate varchar(255), + resourcetype varchar(255), + cellstate varchar(255), + nrpci integer, + nrtac integer, + operationalstate varchar(255), + gnbduid integer, + primary key (celllocalid) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`raninventory` +-- ----------------------------------------------------- +create table raninventory ( + rannfnssiid varchar(255) not null, + isshareable varchar(255), + nsstid varchar(255), + slicetype varchar(255), + subnetstatus varchar(255), + talist varchar(500), + primary key (rannfnssiid) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rannssi` +-- ----------------------------------------------------- +create table rannssi ( + rannfnssiid varchar(255) not null, + rannssilist varchar(255) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rrmpolicyratio` +-- ----------------------------------------------------- +create table rrmpolicyratio ( + rrmpolicyid integer not null, + quotatype varchar(255), + rrmpolicydedicatedratio integer, + rrmpolicymaxratio integer, + rrmpolicyminratio integer, + resourceid varchar(255), + resourcetype varchar(255), + slicetype varchar(255), + primary key (rrmpolicyid) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rrmpolicymember` +-- ----------------------------------------------------- +create table rrmpolicymember ( + plmnid varchar(255) not null, + snssai varchar(255) not null, + rrm_policy_rrmpolicyid integer, + primary key (plmnid, snssai) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`tacells` +-- ----------------------------------------------------- +create table tacells ( + trackingarea varchar(255) not null, + cells varchar(255), + primary key (trackingarea) + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`plmninfo` +-- ----------------------------------------------------- +create table plmninfo ( + plmnid varchar(255) not null, + globalSubscriberId varchar(255), + snssai varchar(255), + status varchar(255), + subscriptionServiceType varchar(255), + gnbcuupid integer, + nrcellcu_celllocalid integer, + nrcelldu_celllocalid integer, + nearrtricid integer, + uLThptPerSlice integer, + dLThptPerSlice integer, + maxNumberOfConns integer, + lastUpdatedTS TIMESTAMP DEFAULT CURRENT_TIMESTAMP() + ) engine=InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`sliceprofile` +-- ----------------------------------------------------- +create table sliceprofile ( + sliceprofileid varchar(255) not null, + coveragearealist varchar(255), + ulthptperslice integer, + dlthptperslice integer, + latency integer, + maxnumberofconns integer, + maxnoofues integer, + plmnidlist varchar(255), + resourcesharinglevel varchar(255), + snssai varchar(255), + uemobilitylevel varchar(255), + rannfnssiid varchar(255), + primary key (sliceprofileid) + ) engine=InnoDB; +-- ----------------------------------------------------- +--Pre-loaded data +-- ----------------------------------------------------- +-- tacells + +INSERT INTO tacells(trackingarea,cells) VALUES('TA1', '15289,15290,15296,15687,15689,15155,15174,15175'); +INSERT INTO tacells(trackingarea,cells) VALUES('TA2', '15176,15825,15826,15425,15426,13999,14000'); +INSERT INTO tacells(trackingarea,cells) VALUES('TA3', '11561,11562,11568,11569,10896,10897,14655,14656'); +INSERT INTO tacells(trackingarea,cells) VALUES('TA4', '13905,13910,15360,15361,15548,15549,14427'); + +--nearrtric +INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(11, 98763, 'NearRTRIC'); +INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(22, 98763, 'NearRTRIC'); +--gnbcucpfunction +INSERT INTO gnbcucpfunction(gnbcuname, gnbid, gnbidlength, nftype,plmnid,nearrtricid) VALUES('cucpserver1', 98763, 32, 'CUCP', '310-410', 11); +INSERT INTO gnbcucpfunction(gnbcuname, gnbid, gnbidlength, nftype,plmnid,nearrtricid) VALUES('cucpserver2', 98763, 32, 'CUCP', '310-410',22); +--gnbcuupfunction +INSERT INTO gnbcuupfunction(gnbcuupid, gnbid, gnbidlength, resourcetype, nearrtricid) VALUES(1111, 98763, 32, 'DRB', 11); +INSERT INTO gnbcuupfunction(gnbcuupid, gnbid, gnbidlength, resourcetype, nearrtricid) VALUES(2222, 98763, 32, 'DRB', 22); +--gnbdufunction +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(1,'gnduserver1', 98763, 32, 'DU', '310-410', 11); +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(2,'gnduserver2', 98763, 32, 'DU', '310-410', 11); +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(3,'gnduserver3', 98763, 32, 'DU', '310-410', 11); +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(4,'gnduserver4', 98763, 32, 'DU', '310-410', 22); +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(5,'gnduserver5', 98763, 32, 'DU', '310-410', 22); +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(6,'gnduserver6', 98763, 32, 'DU', '310-410', 22); +--nrcellcu +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15289,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15290,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15296,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15687,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15689,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15155,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15174,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15175,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15176,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15825,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15826,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15425,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15426,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(13999,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14000,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11561,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11562,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11568,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11569,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(10896,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(10897,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14655,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14656,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(13905,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(13910,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15360,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15361,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15548,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15549,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14427,'RRC Connected Users','cucpserver2'); + +--nrcelldu + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15289,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15290,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15296,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15687,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15689,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15155,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15174,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15175,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15176,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15825,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15826,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15425,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15426,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13999,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14000,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11561,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11562,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11568,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11569,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(10896,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(10897,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14655,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14656,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13905,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13910,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15360,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15361,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15548,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15549,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); + +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14427,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); + diff --git a/ransim/docker/config/ransim/gNBCUConfig.json b/ransim/docker/config/ransim/gNBCUConfig.json new file mode 100644 index 0000000..171239f --- /dev/null +++ b/ransim/docker/config/ransim/gNBCUConfig.json @@ -0,0 +1,772 @@ +[ + { + "gNBCUName": "cucpserver1", + "gNBId": 98763, + "gNBIdLength": 32, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 11, + "cellCUList": [ + { + "cellLocalId": 15289, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15290, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15296, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15687, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15689, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15155, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15174, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15175, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15176, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15825, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15826, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15425, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15426, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13999, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14000, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + } + ] + }, + { + "gNBCUName": "cucpserver2", + "gNBId": 98763, + "gNBIdLength": 32, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 22, + "cellCUList": [ + { + "cellLocalId": 11561, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11562, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11568, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11569, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10896, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10897, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14655, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14656, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13905, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13910, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15360, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15361, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15548, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15549, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14427, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + } + ] + } +] diff --git a/ransim/docker/config/ransim/gNBCUConfig_1NSSAI.json b/ransim/docker/config/ransim/gNBCUConfig_1NSSAI.json new file mode 100644 index 0000000..1e38eef --- /dev/null +++ b/ransim/docker/config/ransim/gNBCUConfig_1NSSAI.json @@ -0,0 +1,472 @@ +[ + { + "gNBCUName": "cucpserver1", + "gNBId": 98763, + "gNBIdLength": 5, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 11, + "cellCUList": [ + { + "cellLocalId": 15289, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15290, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15296, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15687, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15689, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15155, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15174, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15175, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15176, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15825, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15826, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15425, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15426, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13999, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14000, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + } + ] + }, + { + "gNBCUName": "cucpserver2", + "gNBId": 98763, + "gNBIdLength": 5, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 22, + "cellCUList": [ + { + "cellLocalId": 11561, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11562, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11568, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11569, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10896, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10897, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14655, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14656, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 13905, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 13910, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15360, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15361, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15548, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15549, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 14427, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + } + ] + } +] diff --git a/ransim/docker/config/ransim/jssecacerts b/ransim/docker/config/ransim/jssecacerts new file mode 100644 index 0000000..2232b4c Binary files /dev/null and b/ransim/docker/config/ransim/jssecacerts differ diff --git a/ransim/docker/config/ransim/ransim.properties b/ransim/docker/config/ransim/ransim.properties index f6723dc..3be141a 100644 --- a/ransim/docker/config/ransim/ransim.properties +++ b/ransim/docker/config/ransim/ransim.properties @@ -4,10 +4,5 @@ numberOfProcessPerMc=25 numberOfMachines=5 GridSize=1 strictValidateRansimAgentsAvailability=false -sdnrServerIp=10.31.1.79 -sdnrServerPort=30202 -sdnrServerUserid=admin -sdnrServerPassword=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U maxPciValueAllowed=503 -dumpFileName=/tmp/ransim-install/config/latestDump.json diff --git a/ransim/docker/docker-compose.yml b/ransim/docker/docker-compose.yml index eb9b776..6c5c2ba 100644 --- a/ransim/docker/docker-compose.yml +++ b/ransim/docker/docker-compose.yml @@ -3,7 +3,7 @@ networks: default: driver: bridge driver_opts: - com.docker.network.driver.mtu: ${MTU} + com.docker.network.driver.mtu: 1400 services: mariadb: image: 'mariadb:10.0.34' @@ -20,9 +20,15 @@ services: ransim: image: 'onap/ransim:1.0.0-SNAPSHOT' container_name: ransim - hostname: ransimsvr + environment: + - SDNR_IP=10.31.4.51 + - SDNR_PORT=30267 + - SDNR_USER=admin + - SDNR_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + hostname: ransim ports: - '8081:8081' command: ransim volumes: - './config/ransim:/tmp/ransim-install/config' + - './config/ransim/jssecacerts:/tmp/cert/jssecacerts' diff --git a/ransim/docker/ransim-docker/Dockerfile b/ransim/docker/ransim-docker/Dockerfile index a576c92..b139fef 100644 --- a/ransim/docker/ransim-docker/Dockerfile +++ b/ransim/docker/ransim-docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04 +FROM ubuntu:18.04 ARG HTTP_PROXY=${HTTP_PROXY} ARG HTTPS_PROXY=${HTTPS_PROXY} @@ -7,26 +7,27 @@ ENV http_proxy $HTTP_PROXY ENV https_proxy $HTTPS_PROXY RUN \ - apt-get clean && \ - apt-get update && \ - apt-get install -y zip unzip curl wget ssh telnet maven && \ - apt-get install -y software-properties-common && \ - apt-get install -y jq httpie && \ - apt-get install -y python-pip && \ - add-apt-repository ppa:openjdk-r/ppa && \ - apt-get clean && \ - apt-get update && \ - apt-get install -y openjdk-8-jdk +apt-get clean && \ +apt-get update && \ +apt-get install -y zip unzip curl wget ssh telnet maven && \ +apt-get install -y software-properties-common && \ +apt-get install -y jq httpie && \ +apt-get install -y python-pip && \ +apt-get install -y vim && \ +add-apt-repository ppa:openjdk-r/ppa && \ +apt-get clean && \ +apt-get update && \ +apt-get install -y openjdk-8-jdk RUN useradd --create-home --shell /bin/bash policy RUN \ apt-get install -y apt-transport-https && \ - apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db && \ - add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main' && \ - apt-get clean && \ - apt-get update && \ - apt-get install -y mariadb-client +apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 && \ +add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main' && \ +apt-get clean && \ +apt-get update && \ +apt-get install -y mariadb-client RUN mkdir -p /opt/app/policy /tmp/ransim-install && chown policy /opt/app/policy /tmp/ransim-install @@ -39,3 +40,5 @@ USER policy ENTRYPOINT [ "bash", "./do-start.sh" ] + + diff --git a/ransim/docker/ransim-docker/do-start.sh b/ransim/docker/ransim-docker/do-start.sh old mode 100644 new mode 100755 diff --git a/ransim/docker/ransim-docker/docker-install.sh b/ransim/docker/ransim-docker/docker-install.sh old mode 100644 new mode 100755 diff --git a/ransim/docker/ransim-docker/wait-for-port.sh b/ransim/docker/ransim-docker/wait-for-port.sh old mode 100644 new mode 100755 diff --git a/ransim/pom.xml b/ransim/pom.xml index 0c7d0cc..e0ebf7b 100644 --- a/ransim/pom.xml +++ b/ransim/pom.xml @@ -19,6 +19,11 @@ 4.0.0 + + org.onap.oparent + oparent + 2.1.0 + org.onap.ransim ransim pom @@ -32,7 +37,6 @@ UTF-8 UTF-8 https://nexus.onap.org - 1.8 nexus3.onap.org:10001 nexus3.onap.org:10003 @@ -242,6 +246,5 @@ - diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore b/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore index b83d222..0f63015 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore +++ b/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore @@ -1 +1,2 @@ /target/ +/bin/ diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml b/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml index cacf31f..5973f1c 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml +++ b/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml @@ -1,5 +1,4 @@ - - - - + 4.0.0 @@ -30,9 +27,11 @@ 1.0.0-SNAPSHOT + RANSIM-CTRLR RANSIM CTRLR + 2.2.4.RELEASE UTF-8 4.3.3.RELEASE 2.6.0 @@ -96,6 +95,17 @@ + + org.apache.httpcomponents + httpclient + 4.5.6 + + + commons-logging + commons-logging + + + org.eclipse.persistence javax.persistence @@ -131,28 +141,12 @@ commons-logging commons-logging 1.1.3 - - - javax.servlet - servlet-api - - log4j apache-log4j-extras 1.2.17 - - commons-io - commons-io - 2.4 - - - com.google.guava - guava - 19.0 - org.mariadb.jdbc mariadb-java-client @@ -164,17 +158,6 @@ ${springframework.version} test - - org.awaitility - awaitility - 3.0.0 - test - - - org.hsqldb - hsqldb - 2.3.2 - com.sun.jersey jersey-client @@ -191,12 +174,6 @@ 4.12 test - - javax.websocket - javax.websocket-api - 1.1 - provided - org.mockito mockito-core @@ -221,37 +198,17 @@ org.powermock powermock-module-junit4 1.5.6 - - - org.springframework - spring-core - ${springframework.version} - - - org.springframework - spring-web - ${springframework.version} - - - org.springframework - spring-webmvc - ${springframework.version} - - - org.hibernate - hibernate-entitymanager - ${version.org.hibernate} - - - org.hibernate - hibernate-testing - ${version.org.hibernate} - + com.google.code.gson gson 2.6.2 + + org.onosproject + jnc + 1.0 + io.springfox springfox-swagger2 @@ -276,5 +233,65 @@ + + + org.springframework.boot + spring-boot-starter-data-jpa + ${springboot.version} + + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-web + ${springboot.version} + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-webflux + ${springboot.version} + + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.modelmapper + modelmapper + 2.3.8 + + +com.googlecode.json-simple +json-simple +1.1.1 + + + + + + + org.springframework.boot + spring-boot-dependencies + ${springboot.version} + pom + import + + + + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/Application.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/Application.java new file mode 100644 index 0000000..4cf6153 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/Application.java @@ -0,0 +1,17 @@ +package org.onap.ransim; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/RansimDbConfig.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/RansimDbConfig.java new file mode 100644 index 0000000..9f853cb --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/RansimDbConfig.java @@ -0,0 +1,74 @@ +package org.onap.ransim; + +import java.util.HashMap; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +@Configuration +@PropertySource({"classpath:application.properties"}) +@EnableJpaRepositories(basePackages = "org.onap.ransim.rest.api.repository" + + "", entityManagerFactoryRef = "entityManager", transactionManagerRef = "transactionManager") +@ComponentScan(basePackages = "org.onap.ransim") +public class RansimDbConfig { + + @Autowired + Environment env; + + @Bean + @Primary + LocalContainerEntityManagerFactoryBean entityManager () { + LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setPackagesToScan("org.onap.ransim.rest.api.models"); + em.setDataSource(dataSource()); + HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + HashMap properties = new HashMap<>(); + properties.put("hibernate.hbm2ddl.auto", env.getProperty("spring.jpa.hibernate.ddl-auto")); + properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); + em.setJpaPropertyMap(properties); + return em; + } + + /** + * User data source Bean. + */ + @Primary + @Bean + public DataSource dataSource() { + + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(env.getProperty("spring.datasource.driver-class-name")); + dataSource.setUrl(env.getProperty("spring.datasource.url")); + dataSource.setUsername(env.getProperty("spring.datasource.username")); + dataSource.setPassword(env.getProperty("spring.datasource.password")); + + return dataSource; + } + + /** + * User Transaction Manager Bean. + */ + @Primary + @Bean + public PlatformTransactionManager transactionManager() { + JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManager().getObject()); + return transactionManager; + } + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/ServletInitializer.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/ServletInitializer.java new file mode 100644 index 0000000..a808a3e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/ServletInitializer.java @@ -0,0 +1,13 @@ +package org.onap.ransim; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(Application.class); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java new file mode 100644 index 0000000..2900265 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java @@ -0,0 +1,226 @@ +package org.onap.ransim.netconf; + +import java.io.IOException; +import java.net.ConnectException; +import org.apache.log4j.Logger; +import com.tailf.jnc.Device; +import com.tailf.jnc.DeviceUser; +import com.tailf.jnc.Element; +import com.tailf.jnc.JNCException; +import com.tailf.jnc.NetconfSession; +import org.onap.ransim.rest.web.mapper.NearRTRICModel; +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.NRCellDUModel; + +public class NetconfClient { + + static Logger log = Logger.getLogger(NetconfClient.class.getName()); + + private String emsUserName; + private Device device; + + public NetconfClient(Device device) { + this.device = device; + } + + public NetconfClient(String emsUserName, String username, String password, String serverName, String ip, int port) { + DeviceUser deviceUser = new DeviceUser(emsUserName, username, password); + this.emsUserName = emsUserName; + this.device = new Device(serverName, deviceUser, ip, port); + } + + public Element getInitialNodeSet(NearRTRICModel rtRicModel,String serverId) { + try { + + Element ranNetworkElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/ran-network"); + Element nearRTRICElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/NearRTRIC"); + Element idNearRTRICElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/idNearRTRIC"); + idNearRTRICElement.setValue(rtRicModel.getNearRTRICId()); + Element sapElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/sAP"); + Element hostElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/host"); + hostElement.setValue("localhost"); + Element portElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/port"); + portElement.setValue("8080"); + sapElement.addChild(hostElement); + sapElement.addChild(portElement); + + for(GNBCUUPModel gNBCUUPModel:rtRicModel.getgNBCUUPList()) + { + if(gNBCUUPModel.getgNBCUUPId().toString().equals(serverId) || rtRicModel.getNearRTRICId().toString().equals(serverId)) + { + Element gNBCUUPFunctionElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/GNBCUUPFunction"); + Element idGNBCUUPFunctionElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/idGNBCUUPFunction"); + idGNBCUUPFunctionElement.setValue(gNBCUUPModel.getgNBCUUPId().toString()); + Element attributesElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/attributes"); + Element gnBIdElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/gNBId"); + gnBIdElement.setValue(gNBCUUPModel.getgNBId()); + attributesElement.addChild(gnBIdElement); + attributesElement.addChild(sapElement); + gNBCUUPFunctionElement.addChild(idGNBCUUPFunctionElement); + gNBCUUPFunctionElement.addChild(attributesElement); + nearRTRICElement.addChild(gNBCUUPFunctionElement); + } + } + for(GNBCUCPModel gNBCUCPModel : rtRicModel.getgNBCUCPList()) + { + if(gNBCUCPModel.getgNBCUName().equals(serverId) || rtRicModel.getNearRTRICId().toString().equals(serverId)) + { + Element gNBCUCPFunctionElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/GNBCUCPFunction"); + Element idGNBCUCPFunctionElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/idGNBCUCPFunction"); + idGNBCUCPFunctionElement.setValue(gNBCUCPModel.getgNBCUName()); + Element attributesElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/attributes"); + Element gNBCUNameElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/gNBCUName"); + gNBCUNameElement.setValue(gNBCUCPModel.getgNBCUName()); + Element gnBIdElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/gNBId"); + gnBIdElement.setValue(gNBCUCPModel.getgNBId()); + Element gNBIdLengthElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/gNBIdLength"); + gNBIdLengthElement.setValue(gNBCUCPModel.getgNBIdLength()); + attributesElement.addChild(gNBCUNameElement); + attributesElement.addChild(gnBIdElement); + attributesElement.addChild(gNBIdLengthElement); + attributesElement.addChild(sapElement); + for(NRCellCUModel nRCellCUModel:gNBCUCPModel.getCellCUList()) + { + Element nRCellCUElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/NRCellCU"); + Element idNRCellCUElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/idNRCellCU"); + idNRCellCUElement.setValue(nRCellCUModel.getCellLocalId()); + Element nRCellattributesElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/attributes"); + Element cellLocalIdElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/cellLocalId"); + cellLocalIdElement.setValue(nRCellCUModel.getCellLocalId()); + nRCellattributesElement.addChild(cellLocalIdElement); + nRCellattributesElement.addChild(sapElement); + nRCellCUElement.addChild(idNRCellCUElement); + nRCellCUElement.addChild(nRCellattributesElement); + gNBCUCPFunctionElement.addChild(nRCellCUElement); + } + gNBCUCPFunctionElement.addChild(idGNBCUCPFunctionElement); + gNBCUCPFunctionElement.addChild(attributesElement); + nearRTRICElement.addChild(gNBCUCPFunctionElement); + } + } + for(GNBDUModel gNBDUModel:rtRicModel.getgNBDUList()) + { + if(gNBDUModel.getgNBDUId().toString().equals(serverId) || rtRicModel.getNearRTRICId().toString().equals(serverId)) + { + Element gNBDUFunctionElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/GNBDUFunction"); + Element idGNBDUFunctionElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/idGNBDUFunction"); + idGNBDUFunctionElement.setValue(gNBDUModel.getgNBDUId()); + Element attributesElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/attributes"); + Element gNBDUNameElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/gNBDUName"); + gNBDUNameElement.setValue(gNBDUModel.getgNBDUName()); + Element gNBIdLengthElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/gNBIdLength"); + gNBIdLengthElement.setValue(gNBDUModel.getgNBIdLength()); + Element gNBDUIdElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/gNBDUId"); + gNBDUIdElement.setValue(gNBDUModel.getgNBDUId()); + attributesElement.addChild(gNBIdLengthElement); + attributesElement.addChild(gNBDUNameElement); + attributesElement.addChild(gNBDUIdElement); + attributesElement.addChild(sapElement); + for(NRCellDUModel nRCellDUModel : gNBDUModel.getCellDUList()) + { + Element nRCellDUElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/NRCellDU"); + Element idNRCellDUElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/idNRCellDU"); + idNRCellDUElement.setValue(nRCellDUModel.getCellLocalId()); + Element nRCellattributesElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/attributes"); + Element cellLocalIdElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/cellLocalId"); + cellLocalIdElement.setValue(nRCellDUModel.getCellLocalId()); + Element nRSectorCarrierRefElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/nRSectorCarrierRef"); + nRSectorCarrierRefElement.setValue("OU=Sales"); + Element administrativeStateElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/administrativeState"); + administrativeStateElement.setValue(nRCellDUModel.getAdministrativeState()); + Element nRPCIElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/nRPCI"); + nRPCIElement.setValue(nRCellDUModel.getnRPCI()); + Element nRTACElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", + "/nRTAC"); + nRTACElement.setValue(nRCellDUModel.getnRTAC()); + nRCellattributesElement.addChild(cellLocalIdElement); + nRCellattributesElement.addChild(sapElement); + nRCellattributesElement.addChild(nRSectorCarrierRefElement); + nRCellattributesElement.addChild(administrativeStateElement); + nRCellattributesElement.addChild(nRPCIElement); + nRCellattributesElement.addChild(nRTACElement); + nRCellDUElement.addChild(idNRCellDUElement); + nRCellDUElement.addChild(nRCellattributesElement); + gNBDUFunctionElement.addChild(nRCellDUElement); + } + gNBDUFunctionElement.addChild(idGNBDUFunctionElement); + gNBDUFunctionElement.addChild(attributesElement); + nearRTRICElement.addChild(gNBDUFunctionElement); + } + } + + nearRTRICElement.addChild(idNearRTRICElement); + ranNetworkElement.addChild(nearRTRICElement); + + return ranNetworkElement; + + } catch (JNCException e) { + log.error("Exception occured during NodeSet creation {}", e); + return null; + } + + } + + public void editConfig(Element initialConfig) { + try { + Boolean connected = false; + while (!connected) { + try { + Thread.sleep(6000); + device.connect(emsUserName); + connected = true; + } catch (ConnectException e) { + log.error("Device is not up yet... retrying after 3s"); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + } + + } + + device.newSession("cfg"); + log.info(initialConfig.toXMLString()); + device.getSession("cfg").editConfig(NetconfSession.CANDIDATE, initialConfig); + device.getSession("cfg").commit(); + log.info("Initial configuration set"); + } catch (IOException | JNCException e) { + log.error("Exception occured during edit config {}", e); + } + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/FileController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/FileController.java new file mode 100644 index 0000000..5da605c --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/FileController.java @@ -0,0 +1,90 @@ +/*- + * ============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.rest.api.controller; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +@Controller +@RequestMapping("/file") +@CrossOrigin(origins = "*") +@Configuration +@PropertySource(value = "classpath:dumpfileNames.properties") +public class FileController { + + static Logger log = Logger.getLogger(FileController.class.getName()); + + private static final String fileBasePath = "/tmp/ransim-install/config/"; + + @Value("${defaultFiles:}") + List fileList = new ArrayList<>(); + + /** + * Method to upload dump file + * + * @param file + * @return + */ + @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public ResponseEntity uploadToLocalFileSystem(@RequestParam("file") MultipartFile file) { + String fileName = StringUtils.cleanPath(file.getOriginalFilename()); + Path path = Paths.get(fileBasePath + fileName); + try { + Files.copy(file.getInputStream(), path, StandardCopyOption.REPLACE_EXISTING); + fileList.add(fileName); + log.info("File downloaded in " + fileBasePath + fileName); + } catch (IOException e) { + log.error(e); + } + log.info("Copied in path : " + path); + return ResponseEntity.ok("Uploaded successfully"); + } + + /** + * Method to retrieve list of available dump files + * + * @return + */ + @GetMapping(value = "/dumpfiles", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity> getFiles() { + return ResponseEntity.ok(fileList); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RANSliceConfigController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RANSliceConfigController.java new file mode 100644 index 0000000..05de928 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RANSliceConfigController.java @@ -0,0 +1,567 @@ +package org.onap.ransim.rest.api.controller; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PutMapping; + +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +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.NRCellDUModel; +import org.onap.ransim.rest.web.mapper.NearRTRICModel; +import org.onap.ransim.rest.web.mapper.RANSliceInfoModel; +import org.onap.ransim.rest.web.mapper.RRMPolicyRatioModel; + +@RestController +@RequestMapping(path = "/api/ransim-db/v4") +public class RANSliceConfigController { + private static final Logger logger = LoggerFactory.getLogger(RANSliceConfigController.class); + + @Autowired + private RANSliceConfigService ranSliceConfigService; + + //SDN-R APIs + /** + * This method updates the slice details, config details of CUCP + * + * @param GNBCUCPModel + * @return ResponseEntity + */ + @PutMapping(path = "/gNBCUCP") + public ResponseEntity updateGNBCUCPFunction(@RequestBody GNBCUCPModel gNBCUCPModel) { + logger.info("Request Received"); + try { + return new ResponseEntity(ranSliceConfigService.saveGNBCUCP(gNBCUCPModel), HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating GNBCUCP:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the CUCP details + * + * @param gNBCUCPName + * @return ResponseEntity + */ + @GetMapping(path = "/gNBCUCP/{gNBCUCPName}") + public ResponseEntity findGNBCUCPFunction(@PathVariable String gNBCUCPName) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchGNBCUCPData(gNBCUCPName)!=null) { + return new ResponseEntity(ranSliceConfigService.fetchGNBCUCPData(gNBCUCPName), HttpStatus.OK); + }else { + return new ResponseEntity(ranSliceConfigService.fetchGNBCUCPData(gNBCUCPName), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching GNBCUCP:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the slice details, config details of CUUP + * + * @param GNBCUUPModel + * @return ResponseEntity + */ + @PutMapping(path = "/gNBCUUP") + public ResponseEntity updateGNBCUUPFunction(@RequestBody GNBCUUPModel gNBCUUPModel) { + logger.info("Request Received"); + try { + return new ResponseEntity(ranSliceConfigService.saveGNBCUUP(gNBCUUPModel), HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating GNBCUUP:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the CUCP details + * + * @param gNBCUCPName + * @return ResponseEntity + */ + @GetMapping(path = "/gNBCUUP/{gNBCUUPId}") + public ResponseEntity findGNBCUUPFunction(@PathVariable Integer gNBCUUPId) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchGNBCUUPData(gNBCUUPId)!=null) { + return new ResponseEntity(ranSliceConfigService.fetchGNBCUUPData(gNBCUUPId), HttpStatus.OK); + }else { + return new ResponseEntity(ranSliceConfigService.fetchGNBCUUPData(gNBCUUPId), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching GNBCUCP:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the slice details, config details of gNBDU + * + * @param GNBDUModel + * @return ResponseEntity + */ + @PutMapping(path = "/gNBDU") + public ResponseEntity updateGNBDUFunction(@RequestBody GNBDUModel gNBDUModel) { + logger.info("Request Received"); + try { + return new ResponseEntity(ranSliceConfigService.saveGNBDU(gNBDUModel), HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating GNBDU:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the gNBDU details + * + * @param gNBDUId + * @return ResponseEntity + */ + @GetMapping(path = "/gNBDU/{gNBDUId}") + public ResponseEntity findGNBDUFunction(@PathVariable Integer gNBDUId) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchGNBDUData(gNBDUId)!=null) { + return new ResponseEntity(ranSliceConfigService.fetchGNBDUData(gNBDUId), HttpStatus.OK); + }else { + return new ResponseEntity(ranSliceConfigService.fetchGNBDUData(gNBDUId), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching GNBDU:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the NearRTRIC details + * + * @param nearRTRICModel + * @return ResponseEntity + */ + @PutMapping(path = "/nearRTRIC") + public ResponseEntity updateNearRTRIC(@RequestBody NearRTRICModel nearRTRICModel) { + logger.info("Request Received"); + try { + return new ResponseEntity(ranSliceConfigService.saveNearRTRIC(nearRTRICModel), + HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating nearRTRIC:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the nearRTRIC details + * + * @param nearRTRICId + * @return ResponseEntity + */ + @GetMapping(path = "/nearRTRIC/{nearRTRICId}") + public ResponseEntity findNearRTRICFunction(@PathVariable Integer nearRTRICId) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchNearRTRICData(nearRTRICId)!=null) { + return new ResponseEntity(ranSliceConfigService.fetchNearRTRICData(nearRTRICId), + HttpStatus.OK); + }else { + return new ResponseEntity(ranSliceConfigService.fetchNearRTRICData(nearRTRICId), + HttpStatus.NO_CONTENT); + } + + } catch (Exception e) { + logger.error("Error while fetching nearRTRIC:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the RRMPolicy of CU/DU + * + * @param resourceType + * @param resourceId + * @return + */ + @GetMapping(path = "/rrmPolicy/{resourceType}/{resourceId}") + public ResponseEntity findRRMPolicyOfNE(@PathVariable String resourceType, + @PathVariable String resourceId) { + logger.debug("Request Received"); + try { + if(ranSliceConfigService.fetchRRMPolicyOfNE(resourceType, resourceId)!=null) { + return new ResponseEntity( + ranSliceConfigService.fetchRRMPolicyOfNE(resourceType, resourceId), HttpStatus.OK); + }else { + return new ResponseEntity( + ranSliceConfigService.fetchRRMPolicyOfNE(resourceType, resourceId), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching RRMPolicy:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the RRM policy of a network function + * + * @param nearRTRICModel + * @return ResponseEntity + */ + @PostMapping(path = "/rrmPolicy") + public ResponseEntity updateRRMPolicy(@RequestBody RRMPolicyRatioModel rrmPolicy) { + logger.info("Request Received"); + try { + return new ResponseEntity(ranSliceConfigService.updateRRMPolicy(rrmPolicy), HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating RRM Policy:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + + /** + * To find the list of RICs from tracking area + * 1. Find Cells from TA + * 2. find List of RICs of the cells + * + * @param trackingArea + * @return + */ + @GetMapping(path = "/nearrtric-list/{trackingArea}") + public ResponseEntity> findNearRTRICofCellsFromTA(@PathVariable String trackingArea) { + logger.info("Request Received"); + try { + List cellIds = this.findListOfCells(trackingArea).getBody(); + List cellIdList =cellIds.stream().map(Integer::parseInt).collect(Collectors.toList()); + if(ranSliceConfigService.findNearRTRICofCells(cellIdList).size()>0) { + return new ResponseEntity>(ranSliceConfigService.findNearRTRICofCells(cellIdList), + HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findNearRTRICofCells(cellIdList), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the RICs:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the list of CUs in a tracking area + * + * @param trackingArea + * @return + */ + @GetMapping(path = "/cell-list/{trackingArea}") + public ResponseEntity> findListOfCells(@PathVariable String trackingArea) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchCellsofTA(trackingArea).size()>0) { + return new ResponseEntity>(ranSliceConfigService.fetchCellsofTA(trackingArea), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.fetchCellsofTA(trackingArea), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the Cells:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the list of CU-Cells + * + * @param nearRTRICId + * @return + */ + @GetMapping(path = "/cu-cell-list/{nearRTRICId}") + public ResponseEntity> findCUCellsofRIC(@PathVariable Integer nearRTRICId) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchCUCellsofRIC(nearRTRICId).size()>0) { + return new ResponseEntity>(ranSliceConfigService.fetchCUCellsofRIC(nearRTRICId), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.fetchCUCellsofRIC(nearRTRICId), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the Cells-CU:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + + /** + * To find the nearRTRIC of NSSI + * + * This API can be used in Terminate/activate/deactivate to find the RIC from ranNFNSSIId in SO request + * + * @param ranNFNSSIId + * @return List + */ + @GetMapping(path = "/nearrtric/{ranNFNSSIId}") + public ResponseEntity> findNearRTRICByNSSI(@PathVariable String ranNFNSSIId) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.findNearRTRICByNSSI(ranNFNSSIId).size()>0){ + return new ResponseEntity>(ranSliceConfigService.findNearRTRICByNSSI(ranNFNSSIId), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findNearRTRICByNSSI(ranNFNSSIId), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the nearRTRIC by RANNFNSSI:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the list of DU-Cells + * + * @param nearRTRICId + * @return + */ + @GetMapping(path = "/du-cell-list/{sNSSAI}") + public ResponseEntity>> findDUCellsofRIC(@PathVariable String sNSSAI) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchDUCellsofRIC(sNSSAI).size()>0) { + return new ResponseEntity>>(ranSliceConfigService.fetchDUCellsofRIC(sNSSAI), HttpStatus.OK); + }else { + return new ResponseEntity>>(ranSliceConfigService.fetchDUCellsofRIC(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the Cells-DU:" + e.getMessage()); + return new ResponseEntity>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + //Inventory APIs + /** + * This method updates the RAN slice details + * + * @param ranSliceInfoModel + * @return ResponseEntity + */ + @PutMapping(path = "/ranslice-details") + public ResponseEntity updateRANInventory(@RequestBody RANSliceInfoModel ranSliceInfoModel) { + logger.info("Request Received"); + try { + return new ResponseEntity(ranSliceConfigService.updateRANInventory(ranSliceInfoModel), + HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating RAN Inventory:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the RAN slice Details + * + * @param ranNFNSSIId + * @return RANSliceInfoModel + */ + @GetMapping(path = "/ranslice-details/{ranNFNSSIId}") + public ResponseEntity findRANSlice(@PathVariable String ranNFNSSIId) { + logger.info("Request Received"); + try { + if(ranSliceConfigService.fetchRANSlice(ranNFNSSIId)!=null) { + return new ResponseEntity(ranSliceConfigService.fetchRANSlice(ranNFNSSIId), HttpStatus.OK); + }else { + return new ResponseEntity(ranSliceConfigService.fetchRANSlice(ranNFNSSIId), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the RAN slice Details:" + e.getMessage()); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + //Slice Analysis MS APIs + /** + * To fetch The NearRTRICs serving the sNSSAI + * + * @param sNSSAI + * @return List + */ + @GetMapping(path = "/nearrtric/snssai/{sNSSAI}") + public ResponseEntity> findRICsofNSSAI(@PathVariable String sNSSAI){ + logger.info("Request Received"); + try { + if(ranSliceConfigService.findRICsByNSSAI(sNSSAI).size()>0) { + return new ResponseEntity>(ranSliceConfigService.findRICsByNSSAI(sNSSAI), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findRICsByNSSAI(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the nearRTRIC by sNSSAI:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the configuration requested for a slice + * + * @param sNSSAI + * @return + */ + @GetMapping(path="/profile-config/{sNSSAI}") + public ResponseEntity> fetchSliceProfileConfiguration(@PathVariable String sNSSAI){ + logger.info("Request Received"); + try { + if(ranSliceConfigService.findSliceProfileconfig(sNSSAI).size()>0) { + return new ResponseEntity>(ranSliceConfigService.findSliceProfileconfig(sNSSAI), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findSliceProfileconfig(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the Requested Configuration:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the configuration of a slice in RIC + * + * @param sNSSAI + * @return + */ + @GetMapping(path="/slice-config/{sNSSAI}") + public ResponseEntity> fetchSliceConfiguration(@PathVariable String sNSSAI){ + logger.info("Request Received"); + try { + if(ranSliceConfigService.findSliceConfig(sNSSAI).size()>0) { + return new ResponseEntity>(ranSliceConfigService.findSliceConfig(sNSSAI), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findSliceConfig(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the Configuration of a Slice at RIC:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the DU details + * + * @param + * @return List + */ + @GetMapping(path="/du-list/{sNSSAI}") + public ResponseEntity> fetchDUFunctionsOfNSSAI(@PathVariable String sNSSAI){ + logger.info("Request Received::"+sNSSAI); + try { + if(ranSliceConfigService.findDUsofSNssai(sNSSAI).size()>0) { + return new ResponseEntity>(ranSliceConfigService.findDUsofSNssai(sNSSAI), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findDUsofSNssai(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the DU details of NSSAI:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the DU details + * + * @param + * @return List + */ + @GetMapping(path="/cucp-list/{sNSSAI}") + public ResponseEntity> fetchCUFunctionsOfNSSAI(@PathVariable String sNSSAI){ + logger.info("Request Received::"+sNSSAI); + try { + if(ranSliceConfigService.findDUsofSNssai(sNSSAI).size()>0) { + return new ResponseEntity>(ranSliceConfigService.findCUsofSNssai(sNSSAI), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findCUsofSNssai(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the CU details of NSSAI:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the Customer Details + * + * @param + * @return Map + */ + @GetMapping(path="/subscriber-details/{sNSSAI}") + public ResponseEntity> fetchSubsciberDetailsOfNSSAI(@PathVariable String sNSSAI){ + logger.info("Request Received::"+sNSSAI); + try { + if(ranSliceConfigService.getSubscriberDetails(sNSSAI).size()>0) { + return new ResponseEntity>(ranSliceConfigService.getSubscriberDetails(sNSSAI), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.getSubscriberDetails(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the Customer details of NSSAI:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the cu details + * + * @param + * @return List + */ + @GetMapping(path="/cucp-list") + public ResponseEntity> fetchCUCPFunctions(){ + logger.info("Request Received"); + try { + if(ranSliceConfigService.findAllCUCPFunctions().size()>0) { + return new ResponseEntity>(ranSliceConfigService.findAllCUCPFunctions(), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findAllCUCPFunctions(), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the CU details:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the DU details + * + * @param + * @return List + */ + @GetMapping(path="/du-list") + public ResponseEntity> fetchDUFunctions(){ + logger.info("Request Received"); + try { + if(ranSliceConfigService.findAllDUFunctions().size()>0) { + return new ResponseEntity>(ranSliceConfigService.findAllDUFunctions(), HttpStatus.OK); + }else { + return new ResponseEntity>(ranSliceConfigService.findAllDUFunctions(), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the DU details:" + e.getMessage()); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + +} \ No newline at end of file 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 9ea789e..5d15e58 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 @@ -20,1131 +20,742 @@ package org.onap.ransim.rest.api.controller; -import com.google.gson.Gson; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; +import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Properties; -import java.util.Random; -import java.util.Set; -import java.util.UUID; +import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.websocket.Session; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; -import org.onap.ransim.websocket.model.*; -import org.onap.ransim.rest.api.models.CellData; import org.onap.ransim.rest.api.models.CellDetails; import org.onap.ransim.rest.api.models.CellNeighbor; -import org.onap.ransim.rest.api.models.FmAlarmInfo; +import org.onap.ransim.rest.api.models.DeleteACellReq; +import org.onap.ransim.rest.api.models.GetACellDetailReq; import org.onap.ransim.rest.api.models.GetNeighborList; -import org.onap.ransim.rest.api.models.NbrDump; +import org.onap.ransim.rest.api.models.GetNeighborListReq; +import org.onap.ransim.rest.api.models.GetNetconfServerDetailsReq; +import org.onap.ransim.rest.api.models.GetPmDataReq; +import org.onap.ransim.rest.api.models.ModifyACellReq; import org.onap.ransim.rest.api.models.NeighborDetails; -import org.onap.ransim.rest.api.models.NeighborPmDetails; import org.onap.ransim.rest.api.models.NeihborId; import org.onap.ransim.rest.api.models.NetconfServers; import org.onap.ransim.rest.api.models.OperationLog; -import org.onap.ransim.rest.api.models.PmDataDump; -import org.onap.ransim.rest.api.models.PmParameters; -import org.onap.ransim.rest.api.models.TopologyDump; -import org.onap.ransim.rest.client.RestClient; -import org.onap.ransim.websocket.model.FmMessage; -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.PmMessage; -import org.onap.ransim.websocket.model.SetConfigTopology; -import org.onap.ransim.websocket.model.Topology; -import org.onap.ransim.websocket.model.UpdateCell; -import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.onap.ransim.rest.api.models.Topology; +import org.onap.ransim.rest.api.models.TACells; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.api.services.RansimRepositoryService; +import org.onap.ransim.rest.api.controller.RANSliceConfigController; +import org.onap.ransim.rest.api.handler.RansimPciHandler; +import org.onap.ransim.rest.api.handler.RansimSlicingHandler; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import org.onap.ransim.rest.api.services.SlicingPMDataGenerator; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + +@RestController +@Api(value = "Ran Simulator Controller Services") +@RequestMapping("/api") +@CrossOrigin(origins = "*") public class RansimController { - static Logger log = Logger.getLogger(RansimController.class - .getName()); - - private static RansimController rsController = null; - Properties netconfConstants = new Properties(); - int gridSize = 10; - boolean collision = false; - String serverIdPrefix = ""; - static int numberOfCellsPerNcServer = 15; - int numberOfMachines = 1; - int numberOfProcessPerMc = 5; - boolean strictValidateRansimAgentsAvailability = false; - static public Map webSocketSessions = new ConcurrentHashMap(); - static Map serverIdIpPortMapping = new ConcurrentHashMap(); - - static Map globalNcServerUuidMap = new ConcurrentHashMap(); - static List unassignedServerIds = Collections - .synchronizedList(new ArrayList()); - static Map> serverIdIpNodeMapping = new ConcurrentHashMap>(); - int nextServerIdNumber = 1001; - String sdnrServerIp = ""; - int sdnrServerPort = 0; - static String sdnrServerUserid = ""; - static String sdnrServerPassword = ""; - static String dumpFileName = ""; - static long maxPciValueAllowed = 503; - - static RansimPciHandler rsPciHdlr = RansimPciHandler.getRansimPciHandler(); - - private RansimController() { - - } + static Logger log = Logger.getLogger(RansimController.class.getName()); + + private static boolean isPmDataGenerating = false; + private static boolean isIntelligentSlicingPmDataGenerating = false; + + ScheduledExecutorService execService = Executors.newScheduledThreadPool(5); + ScheduledExecutorService execServiceForIntelligentSlicing = Executors.newScheduledThreadPool(5); + ScheduledExecutorService closedLoopExecService; + + @Autowired + RansimRepositoryService ransimRepo; + @Autowired + RansimControllerServices rscServices; + @Autowired + RansimPciHandler rsPciHdlr; + @Autowired + RANSliceConfigController ranSliceConfigController; + @Autowired + RANSliceConfigService ranSliceConfigService; + @Autowired + RansimSlicingHandler ranSliceHandler; + @Autowired + SlicingPMDataGenerator pmDataGenerator; /** - * To accesss variable of this class from another class. + * Start the RAN network simulation. * - * @return returns rscontroller constructor + * @param req gets the necessary details as a request of class type + * StartSimulationReq + * @return returns Http status + * @throws Exception throws exceptions in the functions */ - public static synchronized RansimController getRansimController() { - if (rsController == null) { - rsController = new RansimController(); - new KeepWebsockAliveThread(rsController).start(); + @ApiOperation("Starts the RAN network simulation") + @RequestMapping(value = "/StartSimulation", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation") }) + public ResponseEntity startSimulation(@RequestBody Map dumpfile) throws Exception { + + List cellList = ransimRepo.getCellDetailsList(); + if (!cellList.isEmpty()) { + return new ResponseEntity<>("Already simulation is running.", HttpStatus.INTERNAL_SERVER_ERROR); } - return rsController; - } + try { + rscServices.loadProperties(); + RansimControllerServices.dumpFileName = dumpfile.containsKey("dumpfile") ? dumpfile.get("dumpfile"):null; + long startTimeStartSimulation = System.currentTimeMillis(); + rscServices.generateClusterFromFile(); + rscServices.sendInitialConfigAll(); + long endTimeStartSimulation = System.currentTimeMillis(); + log.info("Time taken for start simulation : " + (endTimeStartSimulation - startTimeStartSimulation)); - private String checkIpPortAlreadyExists(String ipPort, - Map serverIdIpPortMapping) { - String serverId = null; - for (String key : serverIdIpPortMapping.keySet()) { - String value = serverIdIpPortMapping.get(key); - if (value.equals(ipPort)) { - serverId = key; - break; - } - } - return serverId; - } + return new ResponseEntity(HttpStatus.OK); - /** - * Add web socket sessions. - * - * @param ipPort - * ip address for the session - * @param wsSession - * session details - */ - public synchronized String addWebSocketSessions(String ipPort, - Session wsSession) { - loadProperties(); - if (webSocketSessions.containsKey(ipPort)) { - log.info("addWebSocketSessions: Client session " - + wsSession.getId() + " for " + ipPort - + " already exist. Removing old session."); - webSocketSessions.remove(ipPort); + } catch (Exception eu) { + log.info("/StartSimulation ", eu); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } - log.info("addWebSocketSessions: Adding Client session " - + wsSession.getId() + " for " + ipPort); - webSocketSessions.put(ipPort, wsSession); - String serverId = null; - if (!serverIdIpPortMapping.containsValue(ipPort)) { - if (unassignedServerIds.size() > 0) { - log.info("addWebSocketSessions: No serverIds pending to assign for " - + ipPort); - serverId = checkIpPortAlreadyExists(ipPort, - serverIdIpPortMapping); - if (serverId == null) { - serverId = unassignedServerIds.remove(0); - } else { - if (unassignedServerIds.contains(serverId)) { - unassignedServerIds.remove(serverId); - } - } - log.info("RansCtrller = Available unassigned ServerIds :" - + unassignedServerIds); - log.info("RansCtrller = addWebSocketSessions: Adding serverId " - + serverId + " for " + ipPort); - serverIdIpPortMapping.put(serverId, ipPort); - log.debug("RansCtrller = serverIdIpPortMapping >>>> :" - + serverIdIpPortMapping); - mapServerIdToNodes(serverId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - - NetconfServers server = rsDb.getNetconfServer(serverId); - if (server != null) { - server.setIp(ipPort.split(":")[0]); - server.setNetconfPort(ipPort.split(":")[1]); - rsDb.mergeNetconfServers(server); - } + } + + @ApiOperation("Starts the RAN network slice simulation") + @RequestMapping(value = "/StartRanSliceSimulation", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation") }) + public ResponseEntity startRanSliceSimulation() throws Exception { + try { + rscServices.loadGNBFunctionProperties(); + long startTimeStartSimulation = System.currentTimeMillis(); + rscServices.sendRanInitialConfigAll(); + long endTimeStartSimulation = System.currentTimeMillis(); + log.info("Time taken for start ran slice simulation : " + (endTimeStartSimulation - startTimeStartSimulation)); + return new ResponseEntity<>("Simulation started.", HttpStatus.OK); - } catch (Exception e1) { - log.info("Exception mapServerIdToNodes :", e1); - } - } else { - log.info("addWebSocketSessions: No serverIds pending to assign for " - + ipPort); - } - } else { - for (String key : serverIdIpPortMapping.keySet()) { - if (serverIdIpPortMapping.get(key).equals(ipPort)) { - log.info("addWebSocketSessions: ServerId " + key + " for " - + ipPort + " is exist already"); - serverId = key; - break; - } - } + } catch (Exception eu) { + log.info("/StartRanSliceSimulation ", eu); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } - return serverId; } /** - * Map server ID to the cells + * The performance Management Data of each cell will be sent to its netconf + * agent at a regular interval. + * + * @param req Contains the details of node ids which will have bad and poor pm + * values + * @return return HTTP status. * - * @param serverId - * Server ID */ - private void mapServerIdToNodes(String serverId) { - dumpSessionDetails(); - if (serverIdIpNodeMapping.containsKey(serverId)) { - // already mapped.RansimController Do nothing. - } else { - List nodeIds = new ArrayList(); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - List nodes = rsDb.getCellsWithNoServerIds(); - for (CellDetails cell : nodes) { - cell.setServerId(serverId); - nodeIds.add(cell.getNodeId()); - rsDb.mergeCellDetails(cell); - } - serverIdIpNodeMapping.put(serverId, nodeIds); - } catch (Exception e1) { - log.info("Exception mapServerIdToNodes :", e1); - - } - } - } + @ApiOperation("Generate PM data") + @RequestMapping(value = "/GeneratePmData", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation") }) + public ResponseEntity generatePmData(@RequestBody GetPmDataReq req) throws Exception { - /** - * It removes the web socket sessions. - * - * @param ipPort - * ip address of the netconf server - */ - public synchronized void removeWebSocketSessions(String ipPort) { - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - log.info("remove websocket session request received for: " + ipPort); + log.info("Generate PM Data - nodeId_bad: " + req.getNodeIdBad() + ", nodeId_poor: " + req.getNodeIdPoor()); try { - if (webSocketSessions.containsKey(ipPort)) { - String removedServerId = null; - for (String serverId : serverIdIpPortMapping.keySet()) { - String ipPortVal = serverIdIpPortMapping.get(serverId); - if (ipPortVal.equals(ipPort)) { - if (!unassignedServerIds.contains(serverId)) { - unassignedServerIds.add(serverId); - log.info(serverId + "added in unassignedServerIds"); - } - NetconfServers ns = rsDb.getNetconfServer(serverId); - ns.setIp(null); - ns.setNetconfPort(null); - log.info(serverId + " ip and Port set as null "); - rsDb.mergeNetconfServers(ns); - removedServerId = serverId; - break; - } - } - serverIdIpPortMapping.remove(removedServerId); + rsPciHdlr.readPmParameters(); + execService = Executors.newScheduledThreadPool(5); + execService.scheduleAtFixedRate(() -> { + + rsPciHdlr.generatePmData(req.getNodeIdBad(), req.getNodeIdPoor()); + log.info("execService.isTerminated(): " + execService.isTerminated()); + + }, 0, 300, TimeUnit.SECONDS); + + isPmDataGenerating = true; + + return new ResponseEntity<>("Request generated.", HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception: ", eu); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - Session wsSession = webSocketSessions.remove(ipPort); - log.info("removeWebSocketSessions: Client session " - + wsSession.getId() + " for " + ipPort - + " is removed. Server Id : " + removedServerId); - } else { - log.info("addWebSocketSessions: Client session for " + ipPort - + " not exist"); - } - } catch (Exception e) { - log.info("Exception in removeWebSocketSessions. e: " + e); } } /** - * Checks the number of ransim agents running. - * - * @param cellsToBeSimulated - * number of cells to be simulated - * @return returns true if there are enough ransim agents running + * Terminates the ScheduledExecutorService which sends the PM data at regular + * interval. + * + * @return returns HTTP status + * */ - public boolean hasEnoughRansimAgentsRunning(int cellsToBeSimulated) { + @ApiOperation("stop PM data") + @RequestMapping(value = "/stopPmData", method = RequestMethod.GET) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation") }) + public ResponseEntity stopPmData() throws Exception { - log.info("hasEnoughRansimAgentsRunning: numberOfCellsPerNCServer " - + numberOfCellsPerNcServer + " , webSocketSessions.size:" - + webSocketSessions.size() + " , cellsToBeSimulated:" - + cellsToBeSimulated); - log.info(strictValidateRansimAgentsAvailability); + try { + log.info("1. execService.isTerminated(): " + execService.isTerminated()); + if (!execService.isTerminated()) { + execService.shutdown(); + log.info("2. execService.isTerminated(): " + execService.isTerminated()); - if (strictValidateRansimAgentsAvailability) { - if (numberOfCellsPerNcServer * webSocketSessions.size() < cellsToBeSimulated) { - return false; } + isPmDataGenerating = false; + return new ResponseEntity<>("PM data generated.", HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception: ", eu); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } - return true; + } /** - * It updates the constant values in the properties file. + * Get the status of ScheduledExecutorService, whether active or terminated. + * + * @return return the status + * */ - public void loadProperties() { - InputStream input = null; + @ApiOperation("get PM data status") + @RequestMapping(value = "/GetPmDataStatus", method = RequestMethod.GET) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot get information") }) + public boolean getPmDataStatus() throws Exception { + try { - input = new FileInputStream( - "/tmp/ransim-install/config/ransim.properties"); - netconfConstants.load(input); - serverIdPrefix = netconfConstants.getProperty("serverIdPrefix"); - numberOfCellsPerNcServer = Integer.parseInt(netconfConstants - .getProperty("numberOfCellsPerNCServer")); - numberOfMachines = Integer.parseInt(netconfConstants - .getProperty("numberOfMachines")); - numberOfProcessPerMc = Integer.parseInt(netconfConstants - .getProperty("numberOfProcessPerMc")); - strictValidateRansimAgentsAvailability = Boolean - .parseBoolean(netconfConstants - .getProperty("strictValidateRansimAgentsAvailability")); - sdnrServerIp = netconfConstants.getProperty("sdnrServerIp"); - sdnrServerPort = Integer.parseInt(netconfConstants - .getProperty("sdnrServerPort")); - sdnrServerUserid = netconfConstants.getProperty("sdnrServerUserid"); - sdnrServerPassword = netconfConstants - .getProperty("sdnrServerPassword"); - dumpFileName = netconfConstants.getProperty("dumpFileName"); - maxPciValueAllowed = Long.parseLong(netconfConstants - .getProperty("maxPciValueAllowed")); - - } catch (Exception e) { - log.info("Properties file error", e); - } finally { - try { - if (input != null) { - input.close(); - } - } catch (Exception ex) { - log.info("Properties file error", ex); - } + return isPmDataGenerating; + } catch (Exception eu) { + log.error("Exception: ", eu); + return false; } + } /** - * The function adds the cell(with nodeId passed as an argument) to its - * netconf server list if the netconf server already exists. Else it will - * create a new netconf server in the NetconfServers Table and the cell into - * its list. + * The function retrieves RAN simulation network topology. + * + * @return returns Http status + * @throws Exception throws exceptions in the functions * - * @param nodeId - * node Id of the cell */ - static void setNetconfServers(String nodeId) { + @ApiOperation("Retrieves RAN simulation network topology") + @RequestMapping(value = "/GetTopology", method = RequestMethod.GET) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot retrieve the RAN simulation network topology details") }) + public ResponseEntity getTopology() throws Exception { + log.debug("Inside getTopology..."); + try { + rsPciHdlr.checkCollisionAfterModify(); + List cds = ransimRepo.getCellDetailsList(); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - CellDetails currentCell = rsDb.getCellDetail(nodeId); + Topology top = new Topology(); - Set newList = new HashSet(); - try { - if (currentCell != null) { - NetconfServers server = rsDb.getNetconfServer(currentCell - .getServerId()); + if (cds != null && cds.size() > 0) { + top.setMinScreenX(cds.get(0).getScreenX()); + top.setMaxScreenX(cds.get(0).getScreenX()); + top.setMinScreenY(cds.get(0).getScreenY()); + top.setMaxScreenY(cds.get(0).getScreenY()); - if (server == null) { + for (int i = 0; i < cds.size(); i++) { + if (cds.get(i).getScreenX() < top.getMinScreenX()) { + top.setMinScreenX(cds.get(i).getScreenX()); + } + if (cds.get(i).getScreenY() < top.getMinScreenY()) { + top.setMinScreenY(cds.get(i).getScreenY()); + } - server = new NetconfServers(); - server.setServerId(currentCell.getServerId()); - } else { - newList.addAll(server.getCells()); + if (cds.get(i).getScreenX() > top.getMaxScreenX()) { + top.setMaxScreenX(cds.get(i).getScreenX()); + } + if (cds.get(i).getScreenY() > top.getMaxScreenY()) { + top.setMaxScreenY(cds.get(i).getScreenY()); + } } + top.setCellTopology(cds); + } + top.setGridSize(rscServices.gridSize); - newList.add(currentCell); - server.setCells(newList); - log.info("setNetconfServers: nodeId: " + nodeId + ", X:" - + currentCell.getGridX() + ", Y:" - + currentCell.getGridY() + ", ip: " + server.getIp() - + ", portNum: " + server.getNetconfPort() - + ", serverId:" + currentCell.getServerId()); - - rsDb.mergeNetconfServers(server); + Gson gson = new Gson(); + String jsonStr = gson.toJson(top); - } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); } catch (Exception eu) { - log.info("/setNetconfServers Function Error", eu); - + log.error("GetTopology", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); } } - private static double degToRadians(double angle) { - double radians = 57.2957795; - return (angle / radians); - } + /** + * The function retrieves the neighbor list details for the cell with the + * mentioned nodeId. + * + * @param req gets the necessary details as a request of class type + * GetNeighborListReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") + @RequestMapping(value = "/GetNeighborList", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot Insert the given parameters") }) + public ResponseEntity getNeighborList(@RequestBody GetNeighborListReq req) throws Exception { + log.debug("Inside getNeighborList..."); - private static double metersDeglon(double angle) { + try { + String jsonStr = ""; - double d2r = degToRadians(angle); - return ((111415.13 * Math.cos(d2r)) - (94.55 * Math.cos(3.0 * d2r)) + (0.12 * Math - .cos(5.0 * d2r))); + GetNeighborList message = rsPciHdlr.generateNeighborList(req.getNodeId()); - } + if (message != null) { - private static double metersDeglat(double angle) { + log.info("message.getNodeId(): " + message.getNodeId()); - double d2r = degToRadians(angle); - return (111132.09 - (566.05 * Math.cos(2.0 * d2r)) - + (1.20 * Math.cos(4.0 * d2r)) - (0.002 * Math.cos(6.0 * d2r))); + Gson gson = new Gson(); + jsonStr = gson.toJson(message); + } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + } catch (Exception eu) { + log.info("/getNeighborList", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } } /** - * generateClusterFromFile() - * - * @throws IOException + * The function retrieves the neighbor list for the cell with the mentioned + * nodeId. + * + * @param req gets the necessary details as a request of class type + * GetNeighborListReq + * @return returns Http status + * @throws Exception throws exceptions in the functions */ - static void generateClusterFromFile() throws IOException { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - log.info("Inside generateClusterFromFile"); - File dumpFile = null; - String cellDetailsString = ""; + @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") + @RequestMapping(value = "/GetNeighborBlacklistDetails", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot Insert the given parameters") }) + public ResponseEntity getNeighborBlacklistDetails(@RequestBody GetNeighborListReq req) throws Exception { + log.debug("Inside getNeighborList..."); - dumpFile = new File(dumpFileName); - - BufferedReader br = null; try { - log.info("Reading dump file"); - br = new BufferedReader(new FileReader(dumpFile)); - - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - while (line != null) { - sb.append(line); - sb.append("\n"); - line = br.readLine(); - } - cellDetailsString = sb.toString(); - - TopologyDump dumpTopo = new Gson().fromJson(cellDetailsString, - TopologyDump.class); - CellDetails cellsDb = new CellDetails(); - - log.info("dumpTopo.getCellList().size():" - + dumpTopo.getCellList().size()); - for (int i = 0; i < dumpTopo.getCellList().size(); i++) { - Gson g = new Gson(); - String pnt = g.toJson(dumpTopo.getCellList().get(i)); - log.info("Creating Cell:" + pnt); - log.info("Creating Cell:" - + dumpTopo.getCellList().get(i).getCell().getNodeId()); - - cellsDb = new CellDetails(); - entitymanager.getTransaction().begin(); - cellsDb.setNodeId(dumpTopo.getCellList().get(i).getCell() - .getNodeId()); - cellsDb.setPhysicalCellId(dumpTopo.getCellList().get(i) - .getCell().getPhysicalCellId()); - cellsDb.setLongitude(dumpTopo.getCellList().get(i).getCell() - .getLongitude()); - cellsDb.setLatitude(dumpTopo.getCellList().get(i).getCell() - .getLatitude()); - cellsDb.setServerId(dumpTopo.getCellList().get(i).getCell() - .getPnfName()); - if (!unassignedServerIds.contains(cellsDb.getServerId())) { - unassignedServerIds.add(cellsDb.getServerId()); - } - cellsDb.setNetworkId(dumpTopo.getCellList().get(i).getCell() - .getNetworkId()); - - double lon = Float.valueOf(dumpTopo.getCellList().get(i) - .getCell().getLongitude()); - double lat = Float.valueOf(dumpTopo.getCellList().get(i) - .getCell().getLatitude()); - - double xx = (lon - 0) * metersDeglon(0); - double yy = (lat - 0) * metersDeglat(0); - - double rad = Math.sqrt(xx * xx + yy * yy); + String jsonStr = ""; - 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))); - } - - cellsDb.setScreenX((float) (xx)); - cellsDb.setScreenY((float) (yy)); + CellNeighbor neighborList = ransimRepo.getCellNeighbor(req.getNodeId()); - List attachedNoeds = serverIdIpNodeMapping.get(cellsDb - .getServerId()); - log.info("Attaching Cell:" - + dumpTopo.getCellList().get(i).getCell().getNodeId() - + " to " + cellsDb.getServerId()); - if (attachedNoeds == null) { - attachedNoeds = new ArrayList(); - } - attachedNoeds.add(cellsDb.getNodeId()); - serverIdIpNodeMapping.put(cellsDb.getServerId(), attachedNoeds); - if (attachedNoeds.size() > numberOfCellsPerNcServer) { - log.warn("Attaching Cell:" - + dumpTopo.getCellList().get(i).getCell() - .getNodeId() + " to " - + cellsDb.getServerId() - + ", But it is exceeding numberOfCellsPerNcServer " - + numberOfCellsPerNcServer); - } + Map result = new ConcurrentHashMap(); - entitymanager.merge(cellsDb); - entitymanager.flush(); - entitymanager.getTransaction().commit(); + for (NeighborDetails nd : neighborList.getNeighborList()) { - setNetconfServers(cellsDb.getNodeId()); + result.put(nd.getNeigbor().getNeighborCell(), "" + nd.isBlacklisted()); } - dumpSessionDetails(); - - try { - - for (int i = 0; i < dumpTopo.getCellList().size(); i++) { - - String cellNodeId = dumpTopo.getCellList().get(i).getCell() - .getNodeId(); - entitymanager.getTransaction().begin(); - - // neighbor list with the corresponding node id - CellNeighbor neighborList = entitymanager.find( - CellNeighbor.class, cellNodeId); - // cell with the corresponding nodeId - CellDetails currentCell = entitymanager.find( - CellDetails.class, cellNodeId); - - Set newCell = new HashSet(); - - if (currentCell != null) { - if (neighborList == null) { - neighborList = new CellNeighbor(); - neighborList.setNodeId(cellNodeId); - } - List neighboursFromFile = dumpTopo - .getCellList().get(i).getNeighbor(); - log.info("Creating Neighbor for Cell :" + cellNodeId); - for (NbrDump a : neighboursFromFile) { - String id = a.getNodeId().trim(); - boolean noHo = Boolean.parseBoolean(a - .getBlacklisted().trim()); - CellDetails neighborCell = entitymanager.find( - CellDetails.class, id); - NeighborDetails neighborDetails = new NeighborDetails( - new NeihborId(currentCell.getNodeId(), - neighborCell.getNodeId()), noHo); - - newCell.add(neighborDetails); - } - - neighborList.setNeighborList(newCell); - entitymanager.merge(neighborList); - entitymanager.flush(); - - entitymanager.getTransaction().commit(); - - rsPciHdlr.setCollisionConfusionFromFile(cellNodeId); - - } - - } - - } catch (Exception e1) { - log.info("Exception generateClusterFromFile :", e1); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } + if (result != null) { + Gson gson = new Gson(); + jsonStr = gson.toJson(result); } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); - try { - - long startTimeSectorNumber = System.currentTimeMillis(); - for (int i = 0; i < dumpTopo.getCellList().size(); i++) { - - CellData icellData = dumpTopo.getCellList().get(i); - CellDetails icell = entitymanager.find(CellDetails.class, - icellData.getCell().getNodeId()); - int icount = icell.getSectorNumber(); - if (icount == 0) { - entitymanager.getTransaction().begin(); - log.info("Setting sectorNumber for Cell(i) :" - + icell.getNodeId()); - int jcount = 0; - for (int j = (i + 1); j < dumpTopo.getCellList().size(); j++) { - - CellData jcellData = dumpTopo.getCellList().get(j); - if (icellData.getCell().getLatitude() - .equals(jcellData.getCell().getLatitude())) { - if (icellData - .getCell() - .getLongitude() - .equals(jcellData.getCell() - .getLongitude())) { - - if (icount == 0) { - icount++; - jcount = icount + 1; - } - - CellDetails jcell = entitymanager.find( - CellDetails.class, dumpTopo - .getCellList().get(j) - .getCell().getNodeId()); - - jcell.setSectorNumber(jcount); - log.info("Setting sectorNumber for Cell(j) :" - + jcell.getNodeId() - + " icell: " - + icell.getNodeId() - + " Sector number: " + jcount); - entitymanager.merge(jcell); - jcount++; - if (jcount > 3) { - break; - } - } - } - } - icell.setSectorNumber(icount); - entitymanager.merge(icell); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } - - } - - long endTimeSectorNumber = System.currentTimeMillis(); - log.info("Time taken for setting sector number: " - + (endTimeSectorNumber - startTimeSectorNumber)); - - } catch (Exception e3) { - log.info("Exception generateClusterFromFile :", e3); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } + } catch (Exception eu) { + log.error("/getNeighborList", eu); - } catch (Exception e) { - log.info("Exception generateClusterFromFile :", e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } finally { - br.close(); - entitymanager.close(); - emfactory.close(); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); } } /** - * The function deletes the cell from the database with the nodeId passed in - * the arguments. It removes the cell from its neighbor's neighbor list and - * the netconf server list. + * Changes the pci number or nbr list for the given cell. * - * @param nodeId - * node Id of the cell to be deleted. - * @return returns success or failure message + * @param req gets the necessary details as a request of class type + * ModifyACellReq + * @return returns Http status + * @throws Exception throws exceptions in the functions */ - public static String deleteCellFunction(String nodeId) { - String result = "failure node dosent exist"; - log.info("deleteCellFunction called with nodeId :" + nodeId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); + @ApiOperation("Changes the pci number or nbr list for the given cell") + @RequestMapping(value = "/ModifyACell", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot update the PCI for the given cell") }) + public ResponseEntity modifyACell(@RequestBody ModifyACellReq req) throws Exception { + log.debug("Inside ModifyCell..."); try { - CellDetails deleteCelldetail = rsDb.getCellDetail(nodeId); - - CellNeighbor deleteCellNeighbor = rsDb.getCellNeighbor(nodeId); - - if (deleteCelldetail != null) { - if (deleteCellNeighbor != null) { - List cellNeighborList = rsDb - .getCellNeighborList(); - for (CellNeighbor cellNeighbors : cellNeighborList) { - Set currentCellNeighbors = new HashSet( - cellNeighbors.getNeighborList()); - - NeihborId deleteNeighborDetail = new NeihborId( - cellNeighbors.getNodeId(), - deleteCelldetail.getNodeId()); - - if (currentCellNeighbors.contains(deleteNeighborDetail)) { - log.info("Deleted Cell is Neighbor of NodeId : " - + cellNeighbors.getNodeId()); - currentCellNeighbors.remove(deleteNeighborDetail); - cellNeighbors.setNeighborList(currentCellNeighbors); - rsDb.mergeCellNeighbor(cellNeighbors); - } - } + long startTimemodifyCell = System.currentTimeMillis(); - deleteCellNeighbor.getNeighborList().clear(); - rsDb.deleteCellNeighbor(deleteCellNeighbor); - } + String nbrsStr = req.getNewNbrs(); + if (req.getNewNbrs() == null) { + nbrsStr = ""; + } + String source = "GUI"; + List nbrsList = new ArrayList(); + String[] newNbrsArr = nbrsStr.split(","); - rsDb.deleteCellDetails(deleteCelldetail); - result = "cell has been deleted from the database"; + for (int i = 0; i < newNbrsArr.length; i++) { + NeighborDetails cell = new NeighborDetails(new NeihborId(req.getNodeId(), newNbrsArr[i].trim()), false); + nbrsList.add(cell); + } + + int result = rsPciHdlr.modifyCellFunction(req.getNodeId(), req.getNewPhysicalCellId(), nbrsList, source); + rscServices.handleModifyPciFromGui(req.getNodeId(), req.getNewPhysicalCellId()); + long endTimemodifyCell = System.currentTimeMillis(); + log.info("Time taken to modify cell : " + (endTimemodifyCell - startTimemodifyCell)); + + if (result == 200) { + return new ResponseEntity(HttpStatus.OK); + } else if (result == 400) { + return new ResponseEntity(HttpStatus.BAD_REQUEST); } else { - log.info("cell id does not exist"); - result = "failure nodeId dosent exist"; - return result; + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } - } catch (Exception eu) { - log.info("Exception deleteCellFunction :", eu); - result = "exception in function"; + } catch (Exception eu) { + log.error("Exception in modifyACell", eu); + return new ResponseEntity<>("Cannot update the PCI for the given cell", HttpStatus.INTERNAL_SERVER_ERROR); } - return result; + } /** - * Send configuration details to all the netconf server. + * The function changes the PCI number of the cell for the the mentioned nodeId. + * + * @param req gets the necessary details as a request of class type + * GetACellDetailReq + * @return returns Http status + * @throws Exception throws exceptions in the functions */ - public void sendInitialConfigAll() { - RansimControllerDatabase rsDb = new RansimControllerDatabase(); + @ApiOperation("Changes the pci number of the cell for the the mentioned nodeId") + @PostMapping(value = "/GetACellDetail") + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot retrive the cell details for the given cell") }) + public ResponseEntity getACellDetail(@RequestBody GetACellDetailReq req) throws Exception { + + log.debug("Inside GetACellDetailReq..."); try { - dumpSessionDetails(); - List ncServers = rsDb.getNetconfServersList(); - for (NetconfServers netconfServers : ncServers) { - String ipPortKey = serverIdIpPortMapping.get(netconfServers - .getServerId()); - if (ipPortKey == null || ipPortKey.trim().equals("")) { - log.info("No client for " + netconfServers.getServerId()); - for (String ipPortKeyStr : webSocketSessions.keySet()) { - if (!serverIdIpPortMapping.containsValue(ipPortKeyStr)) { - serverIdIpPortMapping.put( - netconfServers.getServerId(), ipPortKeyStr); - ipPortKey = ipPortKeyStr; - break; - } - } - } - if (ipPortKey != null && !ipPortKey.trim().equals("")) { - Session clSess = webSocketSessions.get(ipPortKey); - if (clSess != null) { - sendInitialConfig(netconfServers.getServerId()); - try { - String[] agentDetails = ipPortKey.split(":"); - new RestClient().sendMountRequestToSdnr( - netconfServers.getServerId(), sdnrServerIp, - sdnrServerPort, agentDetails[0], - agentDetails[1], sdnrServerUserid, - sdnrServerPassword); - } catch (Exception ex1) { - log.info("Ignoring exception", ex1); - } - - } else { - log.info("No session for " + ipPortKey); - } - } + String jsonStr = null; + + CellDetails cd = ransimRepo.getCellDetail(req.getNodeId()); + if (cd != null) { + Gson gson = new Gson(); + jsonStr = gson.toJson(cd); } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + } catch (Exception eu) { - log.info("Exception:", eu); + log.error("Exception in getACellDetail : {} ", eu); + return new ResponseEntity<>("Cannot update the PCI for the given cell", HttpStatus.INTERNAL_SERVER_ERROR); } } /** - * Sends initial configuration details of the cells for a new netconf server - * that has been started. + * The function deletes a cell with the mentioned nodeId. * - * @param ipPortKey - * ip address details of the netconf server + * @param req gets the necessary details as a request of class type + * DeleteACellReq + * @return returns Http status + * @throws Exception throws exceptions in the functions */ - public void sendInitialConfigForNewAgent(String ipPortKey, String serverId) { + @ApiOperation("Deletes a cell with the mentioned nodeId") + @RequestMapping(value = "/DeleteACell", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot delete the given cell") }) + public ResponseEntity deleteACell(@RequestBody DeleteACellReq req) throws Exception { + log.debug("Inside delete cell..."); + try { - dumpSessionDetails(); - if (ipPortKey != null && !ipPortKey.trim().equals("")) { - if (serverId != null && !serverId.trim().equals("")) { - Session clSess = webSocketSessions.get(ipPortKey); - if (clSess != null) { - String[] agentDetails = ipPortKey.split(":"); - sendInitialConfig(serverId); - new RestClient().sendMountRequestToSdnr(serverId, - sdnrServerIp, sdnrServerPort, agentDetails[0], - agentDetails[1], sdnrServerUserid, - sdnrServerPassword); - } else { - log.info("No session for " + ipPortKey); - } - } else { - log.info("No serverid for " + ipPortKey); - } - } else { - log.info("Invalid ipPortKey " + ipPortKey); - } + long startTimeDeleteCell = System.currentTimeMillis(); + String result = rscServices.deleteCellFunction(req.getNodeId()); + long endTimeDeleteCell = System.currentTimeMillis(); + log.info("Time taken to delete cell : " + (endTimeDeleteCell - startTimeDeleteCell)); + return new ResponseEntity(HttpStatus.OK); + } catch (Exception eu) { - log.info("Exception:", eu); + log.error("Exception in deleteACell", eu); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } } /** - * To send the initial configration to the netconf server. + * The function stops RAN network simulation and deletes all the cell data from + * the database. * - * @param serverId - * ip address details of the netconf server + * @return returns Http status + * @throws Exception throws exceptions in the functions */ - public void sendInitialConfig(String serverId) { + @ApiOperation("Stops RAN network simulation and deletes all the cell data from the database") + @RequestMapping(value = "/StopSimulation", method = RequestMethod.DELETE) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot stop simulation") }) + public ResponseEntity stopSimulation() throws Exception { + log.debug("Inside stopSimulation..."); + + if (ransimRepo.getCellDetailsList().isEmpty()) { + return new ResponseEntity<>("No simulation is running.", HttpStatus.INTERNAL_SERVER_ERROR); + } - RansimControllerDatabase rsDb = new RansimControllerDatabase(); try { - NetconfServers server = rsDb.getNetconfServer(serverId); - log.info("sendInitialConfig: serverId:" + serverId + ", server:" - + server); - if (server == null) { - return; - } - - String ipPortKey = serverIdIpPortMapping.get(serverId); - - log.info("sendInitialConfig: ipPortKey:" + ipPortKey); - - List cellList = new ArrayList( - server.getCells()); - - List config = new ArrayList(); - - for (int i = 0; i < server.getCells().size(); i++) { - Topology cell = new Topology(); - CellDetails currentCell = rsDb.getCellDetail(cellList.get(i) - .getNodeId()); - CellNeighbor neighbor = rsDb.getCellNeighbor(cellList.get(i) - .getNodeId()); - - cell.setCellId("" + currentCell.getNodeId()); - cell.setPciId(currentCell.getPhysicalCellId()); - cell.setPnfName(serverId); - - List nbrList = new ArrayList(); - Set nbrsDet = neighbor.getNeighborList(); - for (NeighborDetails cellDetails : nbrsDet) { - Neighbor nbr = new Neighbor(); - CellDetails nbrCell = rsDb.getCellDetail(cellDetails - .getNeigbor().getNeighborCell()); - nbr.setNodeId(nbrCell.getNodeId()); - nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); - nbr.setPnfName(nbrCell.getServerId()); - nbr.setServerId(nbrCell.getServerId()); - nbr.setPlmnId(nbrCell.getNetworkId()); - nbr.setBlacklisted(cellDetails.isBlacklisted()); - nbrList.add(nbr); - } - cell.setNeighborList(nbrList); - config.add(i, cell); - } - - SetConfigTopology topo = new SetConfigTopology(); + long startTimStopSimulation = System.currentTimeMillis(); + ransimRepo.deleteNetconfServers(); + ransimRepo.deleteCellNeighbors(); + log.info("Stop simulation : " + (startTimStopSimulation)); + ransimRepo.deleteAllCellDetails(); + String result = rscServices.stopAllSimulation(); + log.info("All cell simulation are stopped...." + result); + long endTimStopSimulation = System.currentTimeMillis(); + log.info("Time taken for stopping simulation : " + (endTimStopSimulation - startTimStopSimulation)); + return new ResponseEntity<>("Success", HttpStatus.OK); - topo.setServerId(server.getServerId()); - String uuid = globalNcServerUuidMap.get(server.getServerId()); - if (uuid == null) { - uuid = getUuid(); - globalNcServerUuidMap.put(server.getServerId(), uuid); - } - topo.setUuid(uuid); + } catch (Exception eu) { + log.error("Exception in stopSimulation", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } - topo.setTopology(config); + } + + @ApiOperation("Stops RAN Slicing network simulation and deletes all the data from the database") + @RequestMapping(value = "/StopRanSliceSimulation", method = RequestMethod.DELETE) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot stop simulation") }) + public ResponseEntity stopRanSliceSimulation() throws Exception { + log.debug("Inside stopSimulation..."); + if (ransimRepo.getCellDetailsList().isEmpty()) { + return new ResponseEntity<>("No simulation is running.", HttpStatus.INTERNAL_SERVER_ERROR); + } - Gson gson = new Gson(); - String jsonStr = gson.toJson(topo); - log.info("ConfigTopologyMessage: " + jsonStr); - Session clSess = webSocketSessions.get(ipPortKey); - RansimWebSocketServer.sendSetConfigTopologyMessage(jsonStr, clSess); + try { + long startTimStopSimulation = System.currentTimeMillis(); + ransimRepo.deleteNetconfServers(); + log.info("Stop simulation : " + (startTimStopSimulation)); + String result = rscServices.stopAllSimulation(); + log.info("All cell simulation are stopped...." + result); + long endTimStopSimulation = System.currentTimeMillis(); + log.info("Time taken for stopping simulation : " + (endTimStopSimulation - startTimStopSimulation)); + return new ResponseEntity<>("Simulation stopped", HttpStatus.OK); } catch (Exception eu) { - log.info("Exception:", eu); + log.error("Exception in stopRanSliceSimulation", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); } } - private static String getUuid() { - return UUID.randomUUID().toString(); - } - /** - * The function alters the database information based on the modifications - * made in the SDNR. + * The function returns the details of a Netconf server for the mentioned server + * id. * - * @param message - * message received from the SDNR - * @param session - * sends the session details - * @param ipPort - * ip address of the netconf server + * @param req gets the necessary details as a request of class type + * GetNetconfServerDetailsReq + * @return returns Http status + * @throws Exception throws exceptions in the functions */ - public void handleModifyPciFromSdnr(String message, Session session, - String ipPort) { - log.info("handleModifyPciFromSDNR: message:" + message + " session:" - + session + " ipPort:" + ipPort); - RansimControllerDatabase rcDb = new RansimControllerDatabase(); - ModifyPci modifyPci = new Gson().fromJson(message, ModifyPci.class); - log.info("handleModifyPciFromSDNR: modifyPci:" + modifyPci.getCellId() - + "; pci: " + modifyPci.getPciId()); - String source = "Netconf"; - - CellDetails cd = rcDb.getCellDetail(modifyPci.getCellId()); - long pci = cd.getPhysicalCellId(); - cd.setPhysicalCellId(modifyPci.getPciId()); - rcDb.mergeCellDetails(cd); - rsPciHdlr.updatePciOperationsTable(modifyPci.getCellId(), source, pci, - modifyPci.getPciId()); - } + @ApiOperation("Returns the details of a Netconf server for the mentioned server id") + @RequestMapping(value = "/GetNetconfServerDetails", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API") }) + public ResponseEntity getNetconfServerDetails(@RequestBody GetNetconfServerDetailsReq req) + throws Exception { - /** - * The function alters the database information based on the modifications - * made in the SDNR. - * - * @param message - * message received from the SDNR - * @param session - * sends the session details - * @param ipPort - * ip address of the netconf server - */ - public void handleModifyNeighborFromSdnr(String message, Session session, - String ipPort) { - log.info("handleModifyAnrFromSDNR: message:" + message + " session:" - + session + " ipPort:" + ipPort); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - ModifyNeighbor modifyNeighbor = new Gson().fromJson(message, - ModifyNeighbor.class); - log.info("handleModifyAnrFromSDNR: modifyPci:" - + modifyNeighbor.getCellId()); - CellDetails currentCell = rsDb - .getCellDetail(modifyNeighbor.getCellId()); - List neighborList = new ArrayList(); - List cellList = new ArrayList(); - cellList.add(modifyNeighbor.getCellId()); - String nbrsAdd = ""; - String nbrsDel = ""; - String source = "Netconf"; - - for (int i = 0; i < modifyNeighbor.getNeighborList().size(); i++) { - if (modifyNeighbor.getNeighborList().get(i).isBlacklisted()) { - NeighborDetails nd = new NeighborDetails(new NeihborId( - modifyNeighbor.getCellId(), modifyNeighbor - .getNeighborList().get(i).getNodeId()), true); - rsDb.mergeNeighborDetails(nd); - cellList.add(modifyNeighbor.getNeighborList().get(i) - .getNodeId()); - if (nbrsAdd.equals("")) { - nbrsDel = modifyNeighbor.getNeighborList().get(i) - .getNodeId(); + try { + log.debug("Inside GetNetconfServerDetails API..."); + String result = ""; + String input = req.getServerId(); + if (input.startsWith("Chn")) { + CellDetails cds = ransimRepo.getCellDetail(input); + if (cds != null) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(cds); + result = "{\"serverId\":\"any\",\"cells\":[" + jsonStr + "]}"; } else { - nbrsDel += "," - + modifyNeighbor.getNeighborList().get(i) - .getNodeId(); + result = ("Cell Id does not exist"); } } else { - NeighborDetails nd = new NeighborDetails(new NeihborId( - modifyNeighbor.getCellId(), modifyNeighbor - .getNeighborList().get(i).getNodeId()), false); - rsDb.mergeNeighborDetails(nd); - cellList.add(modifyNeighbor.getNeighborList().get(i) - .getNodeId()); - if (nbrsDel.equals("")) { - nbrsAdd = modifyNeighbor.getNeighborList().get(i) - .getNodeId(); + NetconfServers ns = ransimRepo.getNetconfServer(input); + if (ns != null) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(ns); + result = jsonStr; } else { - nbrsAdd += "," - + modifyNeighbor.getNeighborList().get(i) - .getNodeId(); + result = ("Server Id does not exist"); } } + return new ResponseEntity<>(result, HttpStatus.OK); + } catch (Exception eu) { + log.error("/GetNetconfServers", eu); + return new ResponseEntity<>("Failure in GetNetconfServerDetails API", HttpStatus.INTERNAL_SERVER_ERROR); } - - for (String cl : cellList) { - RansimPciHandler.setCollisionConfusionFromFile(cl); - } - - log.info("neighbor list: " + neighborList); - - rsPciHdlr.updateNbrsOperationsTable(modifyNeighbor.getCellId(), source, - nbrsAdd, nbrsDel); } - /** - * The function sends the modification made in the GUI to the netconf - * server. - * - * @param cellId - * node Id of the cell which was modified - * @param pciId - * PCI number of the cell which was modified - */ - public void handleModifyPciFromGui(String cellId, long pciId) { - log.info("handleModifyPciFromGUI: cellId:" + cellId + " pciId:" + pciId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); + @ApiOperation("Returns the connection status of all netconf servers") + @RequestMapping(value = "/GetNetconfStatus", method = RequestMethod.GET) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API") }) + public ResponseEntity GetNetconfStatus() throws Exception { try { - CellDetails currentCell = rsDb.getCellDetail(cellId); - CellNeighbor neighborList = rsDb.getCellNeighbor(cellId); - List nbrList = new ArrayList(); - Iterator iter = neighborList.getNeighborList() - .iterator(); - while (iter.hasNext()) { - NeighborDetails nbCell = iter.next(); - Neighbor nbr = new Neighbor(); - CellDetails nbrCell = rsDb.getCellDetail(nbCell.getNeigbor() - .getNeighborCell()); - - nbr.setNodeId(nbrCell.getNodeId()); - nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); - nbr.setPnfName(nbrCell.getNodeName()); - nbr.setServerId(nbrCell.getServerId()); - nbr.setPlmnId(nbrCell.getNetworkId()); - nbrList.add(nbr); + log.debug("Inside GetNetconfServerDetails API..."); + String result = ""; + + List ns = ransimRepo.getNetconfServersList(); + if (ns != null) { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.serializeNulls(); + Gson gson = gsonBuilder.create(); + String jsonStr = gson.toJson(ns); + result = jsonStr; + } else { + result = ("Server Id does not exist"); } - String pnfName = currentCell.getServerId(); - 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); - Gson gson = new Gson(); - String jsonStr = gson.toJson(updatedPci); - if (ipPort != null && !ipPort.trim().equals("")) { - Session clSess = webSocketSessions.get(ipPort); - if (clSess != null) { - RansimWebSocketServer.sendUpdateCellMessage(jsonStr, - clSess); - log.info("handleModifyPciFromGui, message: " + jsonStr); - } else { - log.info("No client session for " + ipPort); - } - } else { - log.info("No client for " + currentCell.getServerId()); - } - } + return new ResponseEntity<>(result, HttpStatus.OK); } catch (Exception eu) { - - log.info("Exception:", eu); + log.error("/GetNetconfServers", eu); + return new ResponseEntity<>("Failure in GetNetconfServerDetails API", HttpStatus.INTERNAL_SERVER_ERROR); } } /** - * The function unmounts the connection with SDNR. + * The function retrieves RAN simulation network topology. + * + * @return returns Http status + * @throws Exception throws exceptions in the functions * - * @return returns null value */ - public String stopAllCells() { - RansimControllerDatabase rcDb = new RansimControllerDatabase(); + @ApiOperation("Retrieves operations log - Modify/Delete operations performed") + @GetMapping(value = "/GetOperationLog") + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot retrieve the Operation Logs") }) + public ResponseEntity getOperationLog() throws Exception { + log.debug("Inside getOperationLog..."); try { - List ncServers = rcDb.getNetconfServersList(); - for (NetconfServers netconfServers : ncServers) { - try { - log.info("Unmount " + netconfServers.getServerId()); - new RestClient().sendUnmountRequestToSdnr( - netconfServers.getServerId(), sdnrServerIp, - sdnrServerPort, sdnrServerUserid, - sdnrServerPassword); - } catch (Exception e) { - log.info("Ignore Exception:", e); - } - serverIdIpNodeMapping.clear(); + List ols = ransimRepo.getOperationLogList(); + if (ols != null && ols.size() > 0) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(ols); + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + } else { + return new ResponseEntity<>("", HttpStatus.OK); } - return "Netconf servers unmounted."; } catch (Exception eu) { - - log.info("Exception:", eu); - return "Error"; - } - - } - - /** - * Used to dump session details. - */ - synchronized public static void dumpSessionDetails() { - - try { - - log.info("serverIdIpPortMapping.size:" - + serverIdIpPortMapping.size() + "webSocketSessions.size" - + webSocketSessions.size()); - for (String key : serverIdIpPortMapping.keySet()) { - String val = serverIdIpPortMapping.get(key); - Session sess = webSocketSessions.get(val); - log.info("ServerId:" + key + " IpPort:" + val + " Session:" - + sess); - } - for (String serverId : unassignedServerIds) { - log.info("Unassigned ServerId:" + serverId); - } - for (String serverId : serverIdIpPortMapping.keySet()) { - List attachedNoeds = serverIdIpNodeMapping - .get(serverId); - if (attachedNoeds != null) { - log.info("ServerId:" + serverId + " attachedNoeds.size:" - + attachedNoeds.size() + " nodes:" - + attachedNoeds.toArray()); - } else { - log.info("ServerId:" + serverId + " attachedNoeds:" + null); - } - } - } catch (Exception e) { - log.info("Exception:", e); + log.error("/GetOperationLog", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); } } -} - -class KeepWebsockAliveThread extends Thread { - static Logger log = Logger - .getLogger(KeepWebsockAliveThread.class.getName()); - RansimController rsCtrlr = null; - KeepWebsockAliveThread(RansimController ctrlr) { - rsCtrlr = ctrlr; - } - - @Override - public void run() { - log.info("Inside KeepWebsockAliveThread run method"); - while (true) { - for (String ipPort : rsCtrlr.webSocketSessions.keySet()) { - try { - Session sess = rsCtrlr.webSocketSessions.get(ipPort); - RansimWebSocketServer.sendPingMessage(sess); - log.debug("Sent ping message to Client ipPort:" + ipPort); - } catch (Exception ex1) { - } - } - try { - Thread.sleep(10000); - } catch (Exception ex) { - } - } - } + @ApiOperation("Generate IntelligentSlicing PM data") + @RequestMapping(value = "/GenerateIntelligentSlicingPmData", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot t the simulation") }) + public ResponseEntity generateIntelligentSlicingPmData(){ + log.info("******************Request to generate***************************"); + + try { + long startTime = (System.currentTimeMillis()); + Iterable tacellList = ranSliceConfigService.fetchAllTA(); + HashMap> taCells = new HashMap<>(); + for(TACells ta : tacellList) + { + String[] cells = ta.getCellsList().split(","); + List cellList = new ArrayList(Arrays.asList(cells)); + taCells.put(ta.getTrackingArea(),cellList); + } + execServiceForIntelligentSlicing = Executors.newScheduledThreadPool(5); + execServiceForIntelligentSlicing.scheduleAtFixedRate( + () -> { + + ranSliceHandler.generateIntelligentSlicingPmData(startTime,taCells); + log.info("execServiceforIntelligentSlicing.isTerminated(): " + execServiceForIntelligentSlicing.isTerminated()); + + }, 0, 10, TimeUnit.SECONDS); + + isIntelligentSlicingPmDataGenerating = true; + + + + } catch (Exception eu) { + log.info("Exception: ", eu); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + + } + return new ResponseEntity<>("IntelligentSlicing PM data generated.", HttpStatus.OK); + } + + @ApiOperation("Stop IntelligentSlicing PM data") + @RequestMapping(value = "/stopIntelligentSlicingPmData", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation") }) + public ResponseEntity stopIntelligentSlicingPmData() throws Exception { + + try { + log.info("1. execServiceForIntelligentSlicing.isTerminated(): " + execServiceForIntelligentSlicing.isTerminated()); + if (!execServiceForIntelligentSlicing.isTerminated()) { + execServiceForIntelligentSlicing.shutdown(); + log.info("2. execServiceForIntelligentSlicing.isTerminated(): " + execServiceForIntelligentSlicing.isTerminated()); + + } + isIntelligentSlicingPmDataGenerating = false; + return new ResponseEntity<>("Stopped PM data generation.", HttpStatus.OK); + + } catch (Exception eu) { + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + + + /* + *Generate closed loopPM data for DUs + * + */ + @ApiOperation("Generate Closed loop PM data") + @RequestMapping(value = "/generateClosedLoopPmData", method = RequestMethod.POST) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Problem generating closed loop PM data") }) + public ResponseEntity generateClosedLoopPmData() { + long startTime = (System.currentTimeMillis()); + log.info("Closed loop PM Data generation started at " + startTime); + closedLoopExecService = Executors.newScheduledThreadPool(5); + closedLoopExecService.scheduleAtFixedRate(() -> { + pmDataGenerator.generateClosedLoopPmData(startTime); + log.info("closedLoopexecService.isTerminated(): " + execServiceForIntelligentSlicing.isTerminated()); + + }, 0, 10, TimeUnit.SECONDS); + + return new ResponseEntity<>("Generating Closed loop PM data.", HttpStatus.OK); + } + + @ApiOperation("Stop Closed loop PM data") + @RequestMapping(value = "/stopClosedLoopPmData", method = RequestMethod.GET) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation") }) + public ResponseEntity stopClosedLoopPmData() throws Exception { + + try { + log.info("1. closedLoopexecService.isTerminated(): " + closedLoopExecService.isTerminated()); + if (!closedLoopExecService.isTerminated()) { + closedLoopExecService.shutdown(); + log.info("2. closedLoopexecService.isTerminated(): " + closedLoopExecService.isTerminated()); + + } + return new ResponseEntity<>("Closed loop PM data generated.", HttpStatus.OK); + + } catch (Exception eu) { + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerDatabase.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerDatabase.java deleted file mode 100644 index 0d7ea3a..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerDatabase.java +++ /dev/null @@ -1,409 +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.rest.api.controller; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.persistence.Query; -import javax.persistence.TypedQuery; - -import org.apache.log4j.Logger; -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.OperationLog; - -public class RansimControllerDatabase { - - static Logger log = Logger.getLogger(RansimControllerDatabase.class - .getName()); - - /** - * Gets the CellDetail from the database. - * - * @param nodeId Node Id of the cell(primary key) - * @return Returns the cell with mentioned node ID. - */ - CellDetails getCellDetail(String nodeId){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - CellDetails currentCell = null; - - try{ - currentCell = entitymanager.find(CellDetails.class, nodeId); - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - - return currentCell; - - } - - /** - * - * @param serverId - * @return - */ - static NetconfServers getNetconfServer(String serverId){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - NetconfServers ns = null; - - try{ - ns = entitymanager.find(NetconfServers.class, serverId); - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - - return ns; - - } - CellNeighbor getCellNeighbor(String nodeId){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - CellNeighbor ns = null; - - try{ - ns = entitymanager.find(CellNeighbor.class, nodeId); - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - - return ns; - - } - - void deleteCellDetails(CellDetails deleteCelldetail){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - - - - try{ - if (deleteCelldetail.getServerId() != null) { - entitymanager.getTransaction().begin(); - log.info("inside NetconfServers handling ...."); - NetconfServers ns = entitymanager.find(NetconfServers.class, deleteCelldetail.getServerId()); - ns.getCells().remove(deleteCelldetail); - entitymanager.merge(ns); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - } - entitymanager.getTransaction().begin(); - CellDetails cd = entitymanager.find(CellDetails.class, deleteCelldetail.getNodeId()); - entitymanager.remove(cd); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - } - - void deleteCellNeighbor(CellNeighbor deleteCellNeighbor){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - - entitymanager.getTransaction().begin(); - - try{ - log.info("inside delete cel neighbor"); - CellNeighbor cn = entitymanager.find(CellNeighbor.class, deleteCellNeighbor.getNodeId()); - entitymanager.remove(cn); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - log.info("removed cell neighbor from database"); - - }catch(Exception e){ - log.info("Exception in deleteCellNeighbor: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - } - - static void mergeCellDetails(CellDetails cellDetail){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - entitymanager.merge(cellDetail); - log.info("updated in database...."); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - }catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - void mergeNeighborDetails(NeighborDetails neighborDetails){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - entitymanager.merge(neighborDetails); - log.info("updated in database...."); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - void mergeNetconfServers(NetconfServers netconfServers){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - entitymanager.merge(netconfServers); - log.info("updated in database...."); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - void mergeCellNeighbor(CellNeighbor cellNeighbor){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - log.info("updated in database...."); - entitymanager.merge(cellNeighbor); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - List getCellDetailsList(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List cds = new ArrayList(); - try{ - entitymanager.getTransaction().begin(); - log.info("updated in database...."); - Query query = entitymanager.createQuery("from CellDetails cd", CellDetails.class); - cds = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cds; - } - - List getCellsWithNoServerIds(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List cds = new ArrayList(); - try{ - entitymanager.getTransaction().begin(); - log.info("getCellswithNoServerIds: updated in database...."); - TypedQuery query = entitymanager.createQuery( - "SELECT n FROM CellDetails WHERE n.serverId is null", CellDetails.class); - cds = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cds; - } - - List getCellsWithCollisionOrConfusion(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List cds = new ArrayList(); - try{ - entitymanager.getTransaction().begin(); - log.info("getCellsWithCollisionOrConfusion: updated in database...."); - Query query = entitymanager - .createQuery( - "from CellDetails cd where cd.pciCollisionDetected=true or cd.pciConfusionDetected=true", - CellDetails.class); - cds = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cds; - } - - List getOperationLogList(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List ols = new ArrayList(); - try{ - entitymanager.getTransaction().begin(); - log.info("updated in database...."); - Query query = entitymanager.createQuery("from OperationLog ol", OperationLog.class); - ols = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return ols; - } - - List getNetconfServersList(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List cnl = new ArrayList(); - try{ - log.info("updated in database...."); - Query query = entitymanager.createQuery("from NetconfServers ns", NetconfServers.class); - cnl = query.getResultList(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cnl; - } - - List getCellNeighborList() { - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List cellNeighborList = new ArrayList(); - try { - entitymanager.getTransaction().begin(); - TypedQuery query = entitymanager.createQuery("from CellNeighbor cn", CellNeighbor.class); - cellNeighborList = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - return cellNeighborList; - } - -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerServices.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerServices.java deleted file mode 100644 index 9fc130c..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerServices.java +++ /dev/null @@ -1,730 +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.rest.api.controller; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.persistence.Query; - -import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.models.CellDetails; -import org.onap.ransim.rest.api.models.CellNeighbor; -import org.onap.ransim.rest.api.models.DeleteACellReq; -import org.onap.ransim.rest.api.models.GetACellDetailReq; -import org.onap.ransim.rest.api.models.GetNeighborList; -import org.onap.ransim.rest.api.models.GetNeighborListReq; -import org.onap.ransim.rest.api.models.GetNetconfServerDetailsReq; -import org.onap.ransim.rest.api.models.GetPmDataReq; -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.OperationLog; -import org.onap.ransim.rest.api.models.Topology; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -@RestController -@Api(value = "Ran Simulator Controller Services") -@RequestMapping("/") -@CrossOrigin(origins = "*") -public class RansimControllerServices { - - static Logger log = Logger.getLogger(RansimControllerServices.class - .getName()); - - private static boolean isSimulationStarted = false; - private static boolean isPmDataGenerating = false; - - private static RansimControllerServices rscServices = null; - - ScheduledExecutorService execService = Executors.newScheduledThreadPool(5); - - private RansimControllerServices() { - - } - - /** - * To accesss variable of this class from another class. - * - * @return returns rscServices constructor - */ - public static synchronized RansimControllerServices getRansimControllerServices() { - if (rscServices == null) { - rscServices = new RansimControllerServices(); - } - return rscServices; - } - - RansimController rsCtrlr = RansimController.getRansimController(); - RansimPciHandler rsPciHdlr = RansimPciHandler.getRansimPciHandler(); - - /** - * Start the RAN network simulation. - * - * @param req - * gets the necessary details as a request of class type - * StartSimulationReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Starts the RAN network simulation") - @RequestMapping(value = "/StartSimulation", method = RequestMethod.POST) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot start the simulation") }) - public ResponseEntity startSimulation() throws Exception { - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - List cellList = rsDb.getCellDetailsList(); - if (!cellList.isEmpty()) { - return new ResponseEntity<>("Already simulation is running.", - HttpStatus.INTERNAL_SERVER_ERROR); - } - - try { - rsCtrlr.loadProperties(); - long startTimeStartSimulation = System.currentTimeMillis(); - rsCtrlr.generateClusterFromFile(); - rsCtrlr.sendInitialConfigAll(); - long endTimeStartSimulation = System.currentTimeMillis(); - log.info("Time taken for start simulation : " - + (endTimeStartSimulation - startTimeStartSimulation)); - - return new ResponseEntity(HttpStatus.OK); - - } catch (Exception eu) { - log.info("/StartSimulation ", eu); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - - /** - * The performance Management Data of each cell will be sent to its netconf - * agent at a regular interval. - * - * @param req - * Contains the details of node ids which will have bad and poor - * pm values - * @return return HTTP status. - * - */ - @ApiOperation("Generate PM data") - @RequestMapping(value = "/GeneratePmData", method = RequestMethod.POST) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot start the simulation") }) - public ResponseEntity generatePmData(@RequestBody GetPmDataReq req) - throws Exception { - - log.info("Inside generatePmData..."); - log.info("nodeId_bad: " + req.getNodeIdBad()); - log.info("nodeId_poor: " + req.getNodeIdPoor()); - - try { - rsPciHdlr.readPmParameters(); - execService = Executors.newScheduledThreadPool(5); - execService.scheduleAtFixedRate( - () -> { - - List resp = rsPciHdlr.generatePmData( - req.getNodeIdBad(), req.getNodeIdPoor()); - log.info("execService.isTerminated(): " - + execService.isTerminated()); - - }, 0, 300, TimeUnit.SECONDS); - - isPmDataGenerating = true; - - return new ResponseEntity<>("Request generated.", HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception: ", eu); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - - } - - } - - /** - * Terminates the ScheduledExecutorService which sends the PM data at - * regular interval. - * - * @return returns HTTP status - * - */ - @ApiOperation("stop PM data") - @RequestMapping(value = "/stopPmData", method = RequestMethod.GET) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot start the simulation") }) - public ResponseEntity stopPmData() throws Exception { - - long startTime = (System.currentTimeMillis() / 1000); - - try { - log.info("1. execService.isTerminated(): " - + execService.isTerminated()); - if (!execService.isTerminated()) { - execService.shutdown(); - log.info("2. execService.isTerminated(): " - + execService.isTerminated()); - - } - isPmDataGenerating = false; - return new ResponseEntity<>("PM data generated.", HttpStatus.OK); - - } catch (Exception eu) { - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - - /** - * Get the status of ScheduledExecutorService, whether active or terminated. - * - * @return return the status - * - */ - @ApiOperation("get PM data status") - @RequestMapping(value = "/GetPmDataStatus", method = RequestMethod.GET) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot get information") }) - public boolean getPmDataStatus() throws Exception { - - try { - return isPmDataGenerating; - } catch (Exception eu) { - return false; - } - - } - - /** - * The function retrieves RAN simulation network topology. - * - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - * - */ - @ApiOperation("Retrieves RAN simulation network topology") - @RequestMapping(value = "/GetTopology", method = RequestMethod.GET) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot retrieve the RAN simulation network topology details") }) - public ResponseEntity getTopology() throws Exception { - log.info("Inside getTopology..."); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - rsPciHdlr.checkCollisionAfterModify(); - List cds = rsDb.getCellDetailsList(); - - Topology top = new Topology(); - - if (cds != null && cds.size() > 0) { - top.setMinScreenX(cds.get(0).getScreenX()); - top.setMaxScreenX(cds.get(0).getScreenX()); - top.setMinScreenY(cds.get(0).getScreenY()); - top.setMaxScreenY(cds.get(0).getScreenY()); - - for (int i = 0; i < cds.size(); i++) { - if (cds.get(i).getScreenX() < top.getMinScreenX()) { - top.setMinScreenX(cds.get(i).getScreenX()); - } - if (cds.get(i).getScreenY() < top.getMinScreenY()) { - top.setMinScreenY(cds.get(i).getScreenY()); - } - - if (cds.get(i).getScreenX() > top.getMaxScreenX()) { - top.setMaxScreenX(cds.get(i).getScreenX()); - } - if (cds.get(i).getScreenY() > top.getMaxScreenY()) { - top.setMaxScreenY(cds.get(i).getScreenY()); - } - } - top.setCellTopology(cds); - } - top.setGridSize(rsCtrlr.gridSize); - - Gson gson = new Gson(); - String jsonStr = gson.toJson(top); - - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/GetTopology", eu); - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function retrieves the neighbor list details for the cell with the - * mentioned nodeId. - * - * @param req - * gets the necessary details as a request of class type - * GetNeighborListReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") - @RequestMapping(value = "/GetNeighborList", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot Insert the given parameters") }) - public ResponseEntity getNeighborList( - @RequestBody GetNeighborListReq req) throws Exception { - log.info("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("/getNeighborList", eu); - - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function retrieves the neighbor list for the cell with the mentioned - * nodeId. - * - * @param req - * gets the necessary details as a request of class type - * GetNeighborListReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") - @RequestMapping(value = "/GetNeighborBlacklistDetails", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot Insert the given parameters") }) - public ResponseEntity getNeighborBlacklistDetails( - @RequestBody GetNeighborListReq req) throws Exception { - log.info("Inside getNeighborList..."); - - try { - String jsonStr = ""; - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - CellNeighbor neighborList = rsDb.getCellNeighbor(req.getNodeId()); - - Map result = new ConcurrentHashMap(); - - for (NeighborDetails nd : neighborList.getNeighborList()) { - - result.put(nd.getNeigbor().getNeighborCell(), - "" + nd.isBlacklisted()); - } - - if (result != null) { - Gson gson = new Gson(); - jsonStr = gson.toJson(result); - } - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/getNeighborList", eu); - - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * Changes the pci number or nbr list for the given cell. - * - * @param req - * gets the necessary details as a request of class type - * ModifyACellReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Changes the pci number or nbr list for the given cell") - @RequestMapping(value = "/ModifyACell", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot update the PCI for the given cell") }) - public ResponseEntity modifyACell(@RequestBody ModifyACellReq req) - throws Exception { - log.info("Inside ModifyCell..."); - - try { - long startTimemodifyCell = System.currentTimeMillis(); - - String nbrsStr = req.getNewNbrs(); - if (req.getNewNbrs() == null) { - nbrsStr = ""; - } - String source = "GUI"; - List nbrsList = new ArrayList(); - String[] newNbrsArr = nbrsStr.split(","); - - for (int i = 0; i < newNbrsArr.length; i++) { - NeighborDetails cell = new NeighborDetails(new NeihborId( - req.getNodeId(), newNbrsArr[i].trim()), false); - nbrsList.add(cell); - } - - int result = rsPciHdlr.modifyCellFunction(req.getNodeId(), - req.getNewPhysicalCellId(), nbrsList, source); - log.info("Inside modify cell : " + (startTimemodifyCell)); - log.info("Result:********************" + result); - rsCtrlr.handleModifyPciFromGui(req.getNodeId(), - req.getNewPhysicalCellId()); - long endTimemodifyCell = System.currentTimeMillis(); - log.info("Time taken to modify cell : " - + (endTimemodifyCell - startTimemodifyCell)); - - if (result == 200) { - return new ResponseEntity(HttpStatus.OK); - } else if (result == 400) { - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } else { - return new ResponseEntity( - HttpStatus.INTERNAL_SERVER_ERROR); - } - - } catch (Exception eu) { - log.info("Exception in modifyACell", eu); - - return new ResponseEntity<>( - "Cannot update the PCI for the given cell", - HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - - /** - * The function changes the PCI number of the cell for the the mentioned - * nodeId. - * - * @param req - * gets the necessary details as a request of class type - * GetACellDetailReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Changes the pci number of the cell for the the mentioned nodeId") - @RequestMapping(value = "/GetACellDetail", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot retrive the cell details for the given cell") }) - public ResponseEntity getACellDetail( - @RequestBody GetACellDetailReq req) throws Exception { - log.info("Inside GetACellDetailReq..."); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - String jsonStr = null; - - CellDetails cd = rsDb.getCellDetail(req.getNodeId()); - - if (cd != null) { - Gson gson = new Gson(); - jsonStr = gson.toJson(cd); - } - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception in modifyACell", eu); - return new ResponseEntity<>( - "Cannot update the PCI for the given cell", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function deletes a cell with the mentioned nodeId. - * - * @param req - * gets the necessary details as a request of class type - * DeleteACellReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Deletes a cell with the mentioned nodeId") - @RequestMapping(value = "/DeleteACell", method = RequestMethod.POST) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot delete the given cell") }) - public ResponseEntity deleteACell(@RequestBody DeleteACellReq req) - throws Exception { - log.info("Inside delete cell..."); - - try { - long startTimeDeleteCell = System.currentTimeMillis(); - String result = rsCtrlr.deleteCellFunction(req.getNodeId()); - log.info("deleted in database...." + result); - long endTimeDeleteCell = System.currentTimeMillis(); - log.info("Time taken to delete cell : " - + (endTimeDeleteCell - startTimeDeleteCell)); - - return new ResponseEntity(HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception in deleteACell", eu); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function stops RAN network simulation and deletes all the cell data - * from the database. - * - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Stops RAN network simulation and deletes all the cell data from the database") - @RequestMapping(value = "/StopSimulation", method = RequestMethod.DELETE) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot stop simulation") }) - public ResponseEntity stopSimulation() throws Exception { - log.info("Inside stopSimulation..."); - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - - Query query = entitymanager.createQuery("from CellDetails cd", - CellDetails.class); - if (query.getResultList() == null) { - return new ResponseEntity<>("No simulation is running.", - HttpStatus.INTERNAL_SERVER_ERROR); - } - - try { - entitymanager.getTransaction().begin(); - long startTimStopSimulation = System.currentTimeMillis(); - Query q3 = entitymanager - .createQuery("DELETE FROM NetconfServers ns"); - q3.executeUpdate(); - - Query q2 = entitymanager.createQuery("DELETE FROM CellNeighbor cn"); - q2.executeUpdate(); - - Query q4 = entitymanager - .createQuery("DELETE FROM NeighborDetails cn"); - q4.executeUpdate(); - - log.info("Stop simulation : " + (startTimStopSimulation)); - Query q1 = entitymanager.createQuery("DELETE FROM CellDetails cd"); - q1.executeUpdate(); - - String result = rsCtrlr.stopAllCells(); - log.info("All cell simulation are stopped...." + result); - - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - long endTimStopSimulation = System.currentTimeMillis(); - log.info("Time taken for stopping simulation : " - + (endTimStopSimulation - startTimStopSimulation)); - - isSimulationStarted = false; - return new ResponseEntity<>("Success", HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception in stopSimulation", eu); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } finally { - entitymanager.close(); - emfactory.close(); - } - - } - - /** - * The function returns the details of a Netconf server for the mentioned - * server id. - * - * @param req - * gets the necessary details as a request of class type - * GetNetconfServerDetailsReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Returns the details of a Netconf server for the mentioned server id") - @RequestMapping(value = "/GetNetconfServerDetails", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API") }) - public ResponseEntity getNetconfServerDetails( - @RequestBody GetNetconfServerDetailsReq req) throws Exception { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try { - log.info("Inside GetNetconfServerDetails API..."); - String result = ""; - entitymanager.getTransaction().begin(); - String input = req.getServerId(); - if (input.startsWith("Chn")) { - CellDetails cds = entitymanager.find(CellDetails.class, input); - if (cds != null) { - Gson gson = new Gson(); - String jsonStr = gson.toJson(cds); - result = "{\"serverId\":\"any\",\"cells\":[" + jsonStr - + "]}"; - } else { - result = ("Cell Id does not exist"); - } - } else { - NetconfServers ns = entitymanager.find(NetconfServers.class, - req.getServerId()); - if (ns != null) { - Gson gson = new Gson(); - String jsonStr = gson.toJson(ns); - result = jsonStr; - } else { - result = ("Server Id does not exist"); - } - } - return new ResponseEntity<>(result, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/GetNetconfServers", eu); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - return new ResponseEntity<>( - "Failure in GetNetconfServerDetails API", - HttpStatus.INTERNAL_SERVER_ERROR); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - @ApiOperation("Returns the connection status of all netconf servers") - @RequestMapping(value = "/GetNetconfStatus", method = RequestMethod.GET) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API") }) - public ResponseEntity GetNetconfStatus() throws Exception { - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - log.info("Inside GetNetconfServerDetails API..."); - String result = ""; - - List ns = rsDb.getNetconfServersList(); - if (ns != null) { - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); - Gson gson = gsonBuilder.create(); - String jsonStr = gson.toJson(ns); - result = jsonStr; - } else { - result = ("Server Id does not exist"); - } - - return new ResponseEntity<>(result, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/GetNetconfServers", eu); - return new ResponseEntity<>( - "Failure in GetNetconfServerDetails API", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function retrieves RAN simulation network topology. - * - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - * - */ - @ApiOperation("Retrieves operations log - Modify/Delete operations performed") - @RequestMapping(value = "/GetOperationLog", method = RequestMethod.GET) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot retrieve the Operation Logs") }) - public ResponseEntity getOperationLog() throws Exception { - log.info("Inside getOperationLog..."); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - List ols = rsDb.getOperationLogList(); - if (ols != null && ols.size() > 0) { - Gson gson = new Gson(); - String jsonStr = gson.toJson(ols); - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - } else { - return new ResponseEntity<>("", HttpStatus.OK); - } - } catch (Exception eu) { - log.info("/GetOperationLog", eu); - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimPciHandler.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimPciHandler.java deleted file mode 100644 index e4796e8..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimPciHandler.java +++ /dev/null @@ -1,1011 +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.rest.api.controller; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.websocket.Session; - -import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.models.CellDetails; -import org.onap.ransim.rest.api.models.CellNeighbor; -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.OperationLog; -import org.onap.ransim.rest.api.models.PmDataDump; -import org.onap.ransim.rest.api.models.PmParameters; -import org.onap.ransim.websocket.model.AdditionalMeasurements; -import org.onap.ransim.websocket.model.CommonEventHeaderFm; -import org.onap.ransim.websocket.model.CommonEventHeaderPm; -import org.onap.ransim.websocket.model.EventFm; -import org.onap.ransim.websocket.model.EventPm; -import org.onap.ransim.websocket.model.FaultFields; -import org.onap.ransim.websocket.model.FmMessage; -import org.onap.ransim.websocket.model.Measurement; -import org.onap.ransim.websocket.model.PmMessage; -import org.onap.ransim.websocket.server.RansimWebSocketServer; - -import com.google.gson.Gson; - -public class RansimPciHandler { - - private static RansimPciHandler rsPciHandler = null; - - private RansimPciHandler() { - - } - - /** - * To accesss variable of this class from another class. - * - * @return returns rscontroller constructor - */ - public static synchronized RansimPciHandler getRansimPciHandler() { - if (rsPciHandler == null) { - rsPciHandler = new RansimPciHandler(); - } - return rsPciHandler; - } - - static Logger log = Logger.getLogger(RansimPciHandler.class - .getName()); - - RansimController rsCtrlr = RansimController.getRansimController(); - - static Map globalFmCellIdUuidMap = new ConcurrentHashMap(); - static Map globalPmCellIdUuidMap = new ConcurrentHashMap(); - - Set cellsWithIssues = new HashSet<>(); - - List pmParameters = new ArrayList(); - int next = 0; - - static FmAlarmInfo setCollisionConfusionFromFile(String cellNodeId) { - - FmAlarmInfo result = new FmAlarmInfo(); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - try { - - boolean collisionDetected = false; - boolean confusionDetected = false; - List nbrPcis = new ArrayList(); - List ConfusionPcis = new ArrayList(); - int collisionCount = 0; - int confusionCount = 0; - CellDetails currentCell = rsDb.getCellDetail(cellNodeId); - - log.info("Setting confusion/collision for Cell :" + cellNodeId); - - GetNeighborList cellNbrDetails = generateNeighborList(cellNodeId); - - for (CellDetails firstLevelNbr : cellNbrDetails.getCellsWithHo()) { - if (nbrPcis - .contains(new Long(firstLevelNbr.getPhysicalCellId()))) { - confusionDetected = true; - if (ConfusionPcis.contains(firstLevelNbr - .getPhysicalCellId())) { - confusionCount++; - } else { - ConfusionPcis.add(firstLevelNbr.getPhysicalCellId()); - confusionCount = confusionCount + 2; - } - - } else { - nbrPcis.add(new Long(firstLevelNbr.getPhysicalCellId())); - } - - if (currentCell.getPhysicalCellId() == firstLevelNbr - .getPhysicalCellId()) { - collisionDetected = true; - collisionCount++; - } - } - - currentCell.setPciCollisionDetected(collisionDetected); - currentCell.setPciConfusionDetected(confusionDetected); - - if (!currentCell.isPciCollisionDetected() - && !currentCell.isPciConfusionDetected()) { - currentCell.setColor("#BFBFBF"); // GREY - No Issues - result.setProblem("No Issues"); - } else if (currentCell.isPciCollisionDetected() - && currentCell.isPciConfusionDetected()) { - currentCell.setColor("#C30000"); // BROWN - Cell has both - // collision & confusion - result.setProblem("CollisionAndConfusion"); - - } else if (currentCell.isPciCollisionDetected()) { - currentCell.setColor("#FF0000"); // RED - Cell has collision - result.setProblem("Collision"); - - } else if (currentCell.isPciConfusionDetected()) { - currentCell.setColor("#E88B00"); // ORANGE - Cell has confusion - result.setProblem("Confusion"); - - } else { - currentCell.setColor("#BFBFBF"); // GREY - No Issues - result.setProblem("No Issues"); - } - - result.setCollisionCount("" + collisionCount); - result.setConfusionCount("" + confusionCount); - - rsDb.mergeCellDetails(currentCell); - - return result; - - } catch (Exception e2) { - log.info("setCollisionConfusionFromFile :", e2); - - return null; - } - - } - - /** - * Generates separate list of neighbors with and without hand-off for a - * cell. - * - * @param nodeId - * Node Id of cell for which the neighbor list is generated - * @return Returns GetNeighborList object - */ - static GetNeighborList generateNeighborList(String nodeId) { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try { - log.info("inside generateNeighborList for: " + nodeId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - CellNeighbor neighborList = entitymanager.find(CellNeighbor.class, - nodeId); - GetNeighborList result = new GetNeighborList(); - - List cellsWithNoHO = new ArrayList(); - List cellsWithHO = new ArrayList(); - - List nbrList = new ArrayList( - neighborList.getNeighborList()); - long readCellDetail = 0; - long checkBlacklisted = 0; - - for (int i = 0; i < nbrList.size(); i++) { - - CellDetails nbr = entitymanager.find(CellDetails.class, 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); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - return null; - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - static void checkCollisionAfterModify() { - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - List checkCollisionConfusion = rsDb - .getCellsWithCollisionOrConfusion(); - - for (int i = 0; i < checkCollisionConfusion.size(); i++) { - log.info(checkCollisionConfusion.get(i).getNodeId()); - setCollisionConfusionFromFile(checkCollisionConfusion.get(i) - .getNodeId()); - } - } catch (Exception eu) { - log.info("checkCollisionAfterModify", eu); - } - } - - /** - * It updates the cell with its new neighbor list and PCI and updates the - * change in a database. - * - * @param nodeId - * node Id of the cell - * @param physicalCellId - * PCI number of the cell - * @param newNbrs - * List of new neighbors for the cell - * @param source - * The source from which cell modification has been triggered - * @return returns success or failure message - */ - public int modifyCellFunction(String nodeId, long physicalCellId, - List newNbrs, String source) { - - int result = 111; - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - log.info("modifyCellFunction nodeId:" + nodeId + ", physicalCellId:" - + physicalCellId); - CellDetails modifyCell = rsDb.getCellDetail(nodeId); - - if (modifyCell != null) { - if (physicalCellId < 0 - || physicalCellId > rsCtrlr.maxPciValueAllowed) { - log.info("NewPhysicalCellId is empty or invalid"); - result = 400; - } else { - long oldPciId = modifyCell.getPhysicalCellId(); - if (physicalCellId != oldPciId) { - updatePciOperationsTable(nodeId, source, physicalCellId, - oldPciId); - - modifyCell.setPhysicalCellId(physicalCellId); - rsDb.mergeCellDetails(modifyCell); - } - - CellNeighbor neighbors = rsDb.getCellNeighbor(nodeId); - List oldNbrList = new ArrayList( - neighbors.getNeighborList()); - List oldNbrListWithHo = new ArrayList(); - - for (NeighborDetails cell : oldNbrList) { - if (!cell.isBlacklisted()) { - oldNbrListWithHo.add(cell); - } - } - - boolean flag = false; - - List addedNbrs = new ArrayList(); - List deletedNbrs = new ArrayList(); - - String nbrsDel = ""; - - List oldNbrsArr = new ArrayList(); - for (NeighborDetails cell : oldNbrListWithHo) { - oldNbrsArr.add(cell.getNeigbor().getNeighborCell()); - } - - List newNbrsArr = new ArrayList(); - for (NeighborDetails cell : newNbrs) { - newNbrsArr.add(cell.getNeigbor().getNeighborCell()); - } - - for (NeighborDetails cell : oldNbrListWithHo) { - - if (!newNbrsArr.contains(cell.getNeigbor() - .getNeighborCell())) { - if (!flag) { - flag = true; - } - deletedNbrs.add(cell); - if (nbrsDel == "") { - nbrsDel = cell.getNeigbor().getNeighborCell(); - } else { - nbrsDel += "," - + cell.getNeigbor().getNeighborCell(); - } - log.info("deleted cell: " - + cell.getNeigbor().getNeighborCell() - + cell.isBlacklisted()); - - } - } - - String nbrsAdd = ""; - - for (NeighborDetails cell : newNbrs) { - if (cell.isBlacklisted()) { - addedNbrs.add(cell); - } else { - if (!oldNbrsArr.contains(cell.getNeigbor() - .getNeighborCell())) { - addedNbrs.add(cell); - if (nbrsAdd == "") { - nbrsAdd = cell.getNeigbor().getNeighborCell(); - } else { - nbrsAdd += "," - + cell.getNeigbor().getNeighborCell(); - } - log.info("added cell: " - + cell.getNeigbor().getNeighborCell() - + cell.isBlacklisted()); - } - } - - } - List newNeighborList = new ArrayList( - oldNbrList); - for (NeighborDetails cell : deletedNbrs) { - NeighborDetails removeHo = new NeighborDetails( - cell.getNeigbor(), true); - rsDb.mergeNeighborDetails(removeHo); - newNeighborList.add(removeHo); - } - - for (NeighborDetails cell : addedNbrs) { - rsDb.mergeNeighborDetails(cell); - newNeighborList.add(cell); - } - - if (!flag) { - if (newNbrs.size() != oldNbrList.size()) { - flag = true; - } - } - - if (flag) { - updateNbrsOperationsTable(nodeId, source, nbrsAdd, nbrsDel); - } - - if (newNbrs != null) { - neighbors.getNeighborList().clear(); - Set updatedNbrList = new HashSet( - newNeighborList); - neighbors.setNeighborList(updatedNbrList); - rsDb.mergeCellNeighbor(neighbors); - } - - generateFmData(source, modifyCell, newNeighborList); - - result = 200; - } - - - } else { - result = 400; - } - - return result; - } - - public void checkCellsWithIssue() { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try { - - for (String id : cellsWithIssues) { - CellDetails currentCell = entitymanager.find(CellDetails.class, - id); - FmMessage fmDataMessage = new FmMessage(); - List data = new ArrayList(); - - if (!currentCell.isPciCollisionDetected()) { - if (!currentCell.isPciConfusionDetected()) { - - cellsWithIssues.remove(id); - CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); - FaultFields faultFields = new FaultFields(); - - commonEventHeader.setStartEpochMicrosec(System - .currentTimeMillis() * 1000); - commonEventHeader - .setSourceName(currentCell.getNodeId()); - commonEventHeader.setReportingEntityName(currentCell - .getServerId()); - String uuid = globalFmCellIdUuidMap.get(currentCell - .getNodeId()); - commonEventHeader.setSourceUuid(uuid); - - faultFields - .setAlarmCondition("RanPciCollisionConfusionOccurred"); - faultFields.setEventSeverity("NORMAL"); - faultFields.setEventSourceType("other"); - faultFields.setSpecificProblem("Problem Solved"); - - commonEventHeader.setLastEpochMicrosec(System - .currentTimeMillis() * 1000); - - EventFm event = new EventFm(); - event.setCommonEventHeader(commonEventHeader); - event.setFaultFields(faultFields); - - data.add(event); - } - } - - fmDataMessage.setFmEventList(data); - - if (!data.isEmpty()) { - sendFmData(currentCell.getServerId(), fmDataMessage); - } - - } - - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - } - - void updatePciOperationsTable(String nodeId, String source, long physicalCellId, long oldPciId) { - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - OperationLog operationLog = new OperationLog(); - - entitymanager.getTransaction().begin(); - operationLog.setNodeId(nodeId); - operationLog.setFieldName("PCID"); - operationLog.setOperation("Modify"); - operationLog.setSource(source); - operationLog.setTime(System.currentTimeMillis()); - operationLog.setMessage("PCID value changed from " + oldPciId + " to " + physicalCellId); - entitymanager.merge(operationLog); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } - - void updateNbrsOperationsTable(String nodeId, String source, String addedNbrs, String deletedNbrs) { - - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - entitymanager.getTransaction().begin(); - OperationLog operationLogNbrChng = new OperationLog(); - operationLogNbrChng.setNodeId(nodeId); - operationLogNbrChng.setFieldName("Neighbors"); - operationLogNbrChng.setOperation("Modify"); - operationLogNbrChng.setSource(source); - - log.info(" Neighbors added " + addedNbrs + "."); - log.info(" Neighbors removed " + deletedNbrs + "."); - String message = ""; - if(!addedNbrs.equals("")){ - message += " Neighbors added " + addedNbrs + "." ; - } - - if(!deletedNbrs.equals("")){ - message += " Neighbors removed " + deletedNbrs + "." ; - } - - operationLogNbrChng.setMessage(message); - operationLogNbrChng.setTime(System.currentTimeMillis()); - entitymanager.merge(operationLogNbrChng); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - } - - /** - * Sends PM message to the netconf agent through the websocket server. - * - * @param serverId - * Netconf agent - Server ID to which the message is sent. - * @param pmMessage - * PM message to be sent. - */ - void sendPmdata(String serverId, String pmMessage) { - - log.info("Sending PM message to netconf agent"); - - String ipPort = rsCtrlr.serverIdIpPortMapping.get(serverId); - - if (ipPort != null && !ipPort.trim().equals("")) { - - String[] ipPortArr = ipPort.split(":"); - if (ipPort != null && !ipPort.trim().equals("")) { - - Session clSess = rsCtrlr.webSocketSessions.get(ipPort); - log.info("PM message. Netconf agent IP:" + ipPort); - if (clSess != null) { - RansimWebSocketServer.sendPmMessage(pmMessage, clSess); - log.info("Pm Data jsonStr: " + pmMessage); - log.info("PM message sent to netconf agent"); - } else { - log.info("No client session for " + ipPort); - } - } else { - log.info("Pm message not sent, ipPort is null"); - } - } else { - - log.info("Pm message not sent, ipPort is null. Server Id: " - + serverId); - } - - } - - /** - * - * Reads the values PM parameter values from a dump file. - * - */ - public void readPmParameters() { - - File dumpFile = null; - String kpiName = ""; - PmDataDump pmDump = null; - String jsonString = ""; - int next = 0; - dumpFile = new File("PM_Kpi_Data.json"); - - BufferedReader br = null; - - try { - log.info("Reading dump file"); - br = new BufferedReader(new FileReader(dumpFile)); - - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - - while (line != null) { - sb.append(line); - sb.append("\n"); - line = br.readLine(); - } - jsonString = sb.toString(); - - pmDump = new Gson().fromJson(jsonString, PmDataDump.class); - log.info("Dump value: " - + pmDump.getKpiDump().get(0).getParameter1()); - pmParameters = new ArrayList(pmDump.getKpiDump()); - - } catch (Exception eu) { - log.info("Exception: ", eu); - } - } - - private static String getUuid() { - return UUID.randomUUID().toString(); - } - - /** - * Sets values for all the parameters in the PM message - * - * @param nodeIdBad - * List of node Ids with bad performance values - * @param nodeIdPoor - * List of node Ids with poor performance values - * @return It returns the pm message - */ - public List generatePmData(String nodeIdBad, String nodeIdPoor) { - - List result = new ArrayList<>(); - RansimControllerDatabase rcDb = new RansimControllerDatabase(); - - String parameter1 = ""; - String successValue1 = ""; - String badValue1 = ""; - String poorValue1 = ""; - String parameter2 = ""; - String successValue2 = ""; - String badValue2 = ""; - String poorValue2 = ""; - - try { - - if (next >= pmParameters.size()) { - next = 0; - log.info("next : " + next); - } - try { - log.info("next : " + next); - parameter1 = pmParameters.get(next).getParameter1(); - successValue1 = pmParameters.get(next).getSuccessValue1(); - badValue1 = pmParameters.get(next).getBadValue1(); - poorValue1 = pmParameters.get(next).getPoorValue1(); - parameter2 = pmParameters.get(next).getParameter2(); - successValue2 = pmParameters.get(next).getSuccessValue2(); - badValue2 = pmParameters.get(next).getBadValue2(); - poorValue2 = pmParameters.get(next).getPoorValue2(); - next++; - } catch (Exception e) { - log.info("Exception: ", e); - } - - List cnl = rcDb.getNetconfServersList(); - log.info("obtained data from db"); - String[] cellIdsBad = null; - String[] cellIdsPoor = null; - Set nodeIdsBad = new HashSet(); - Set nodeIdsPoor = new HashSet(); - - if (nodeIdBad != null) { - cellIdsBad = nodeIdBad.split(","); - for (int a = 0; a < cellIdsBad.length; a++) { - nodeIdsBad.add(cellIdsBad[a].trim()); - } - } - if (nodeIdPoor != null) { - cellIdsPoor = nodeIdPoor.split(","); - for (int a = 0; a < cellIdsPoor.length; a++) { - nodeIdsPoor.add(cellIdsPoor[a].trim()); - } - } - - for (int i = 0; i < cnl.size(); i++) { - - long startTime = System.currentTimeMillis(); - List cellList = new ArrayList(cnl - .get(i).getCells()); - List data = new ArrayList(); - - 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(); - - List additionalMeasurements = new ArrayList(); - 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 hashMap = new HashMap(); - 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 hashMap = new HashMap(); - - 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(); - } - - 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 - * Network Id of the cell - * @param ncServer - * Server Id of the cell - * @param cellId - * Node Id of the cell - * @param issue - * Contains the collision/confusion details of the cess - * @return returns EventFm object, with all the necessary parameters. - */ - public static EventFm setEventFm(String networkId, String ncServer, - String cellId, FmAlarmInfo issue) { - - log.info("Inside generate FmData"); - EventFm event = new EventFm(); - - try { - - CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); - FaultFields faultFields = new FaultFields(); - - commonEventHeader - .setStartEpochMicrosec(System.currentTimeMillis() * 1000); - commonEventHeader.setSourceName(cellId); - commonEventHeader.setReportingEntityName(ncServer); - - String uuid = globalFmCellIdUuidMap.get(cellId); - if (uuid == null) { - uuid = getUuid(); - globalFmCellIdUuidMap.put(cellId, uuid); - } - commonEventHeader.setSourceUuid(uuid); - - if (issue.getProblem().equals("Collision") - || issue.getProblem().equals("Confusion") - || issue.getProblem().equals("CollisionAndConfusion")) { - faultFields - .setAlarmCondition("RanPciCollisionConfusionOccurred"); - faultFields.setEventSeverity("CRITICAL"); - faultFields.setEventSourceType("other"); - faultFields.setSpecificProblem(issue.getProblem()); - - Map alarmAdditionalInformation = new HashMap(); - alarmAdditionalInformation.put("networkId", networkId); - alarmAdditionalInformation.put("collisions", - issue.getCollisionCount()); - alarmAdditionalInformation.put("confusions", - issue.getConfusionCount()); - - faultFields - .setAlarmAdditionalInformation(alarmAdditionalInformation); - - } - commonEventHeader - .setLastEpochMicrosec(System.currentTimeMillis() * 1000); - - event.setCommonEventHeader(commonEventHeader); - event.setFaultFields(faultFields); - - } catch (Exception e) { - log.info("Exception: ", e); - } - - return event; - - } - - /** - * It checks if the cell or any of its neighbors have collision/confusion - * issue. If there are any issues it generates the FM data for the entire - * cluster - * - * @param source - * The source from which the cell modification has been - * triggered. - * @param cell - * Details of the given cell. - * @param newNeighborList - * Neighbor list of the given cell. - */ - public void generateFmData(String source, CellDetails cell, - List newNeighborList) { - - List listCellIssue = new ArrayList(); - Set ncs = new HashSet<>(); - log.info("Generating Fm data"); - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - FmAlarmInfo op1 = setCollisionConfusionFromFile(cell.getNodeId()); - - if (source.equals("GUI")) { - if (op1.getProblem().equals("CollisionAndConfusion") - || op1.getProblem().equals("Collision") - || op1.getProblem().equals("Confusion")) { - log.info("op1: " + op1); - EventFm lci = setEventFm(cell.getNetworkId(), - cell.getServerId(), cell.getNodeId(), op1); - listCellIssue.add(lci); - ncs.add(cell.getServerId()); - log.info("Generating Fm data for: " + cell.getNodeId()); - } - } - - for (NeighborDetails cd : newNeighborList) { - FmAlarmInfo op2 = setCollisionConfusionFromFile(cd.getNeigbor() - .getNeighborCell()); - CellDetails nbrCell = rsDb.getCellDetail(cd.getNeigbor() - .getNeighborCell()); - - if (source.equals("GUI")) { - if (op2.getProblem().equals("CollisionAndConfusion") - || op2.getProblem().equals("Collision") - || op2.getProblem().equals("Confusion")) { - EventFm lci = setEventFm(nbrCell.getNetworkId(), - nbrCell.getServerId(), nbrCell.getNodeId(), op2); - log.info("FmData added:" + nbrCell.getNodeId()); - listCellIssue.add(lci); - ncs.add(nbrCell.getServerId()); - log.info("Generating Fm data for: " + nbrCell.getNodeId()); - } - } - - } - - if (source.equals("GUI")) { - for (String nc : ncs) { - - FmMessage fmDataMessage = new FmMessage(); - List data = new ArrayList(); - log.info("listCellIssue.size(): " + listCellIssue.size()); - for (EventFm cellIssue : listCellIssue) { - if (cellIssue.getCommonEventHeader() - .getReportingEntityName().equals(nc)) { - data.add(cellIssue); - if (!cellsWithIssues.contains(cellIssue - .getCommonEventHeader().getSourceName())) { - cellsWithIssues.add(cellIssue - .getCommonEventHeader().getSourceName()); - } - - } - } - log.info("data.size(): " + data.size()); - - if (data.size() > 0) { - fmDataMessage.setFmEventList(data); - log.info("Sending FM message: "); - sendFmData(nc, fmDataMessage); - } - - } - } - - } - - /** - * Sends the FM data message to the netconf agent through the ransim - * websocket server. - * - * @param serverId - * server id of the netconf agent - * @param fmDataMessage - * FM message to be sent - */ - public void sendFmData(String serverId, FmMessage fmDataMessage) { - - log.info("inside sendFmData"); - Gson gson = new Gson(); - String jsonStr = gson.toJson(fmDataMessage); - - log.info("Fm Data jsonStr: " + jsonStr); - - String ipPort = rsCtrlr.serverIdIpPortMapping.get(serverId); - - if (ipPort != null && !ipPort.trim().equals("")) { - - String[] ipPortArr = ipPort.split(":"); - log.info("Connection estabilished with ip: " + ipPort); - if (ipPort != null && !ipPort.trim().equals("")) { - Session clSess = rsCtrlr.webSocketSessions.get(ipPort); - if (clSess != null) { - log.info("FM message sent."); - RansimWebSocketServer.sendFmMessage(jsonStr, clSess); - } else { - log.info("No client session for " + ipPort); - } - } else { - log.info("No client for " + serverId); - } - } else { - log.info("No client for "); - } - - } - -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java new file mode 100644 index 0000000..f2ad4eb --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java @@ -0,0 +1,27 @@ +package org.onap.ransim.rest.api.exceptions; + +public class RansimException extends Throwable { + + public RansimException() { + super(); + } + + public RansimException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + + public RansimException(String message, Throwable cause) { + super(message, cause); + } + + public RansimException(String message) { + super(message); + } + + public RansimException(Throwable cause) { + super(cause); + } + + + +} 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 new file mode 100644 index 0000000..2149c4e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java @@ -0,0 +1,963 @@ +/*- + }* ============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.rest.api.handler; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import javax.websocket.Session; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.models.CellDetails; +import org.onap.ransim.rest.api.models.CellNeighbor; +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.OperationLog; +import org.onap.ransim.rest.api.models.PmDataDump; +import org.onap.ransim.rest.api.models.PmParameters; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RansimRepositoryService; +import org.onap.ransim.websocket.model.AdditionalMeasurements; +import org.onap.ransim.websocket.model.CommonEventHeaderFm; +import org.onap.ransim.websocket.model.CommonEventHeaderPm; +import org.onap.ransim.websocket.model.EventFm; +import org.onap.ransim.websocket.model.EventPm; +import org.onap.ransim.websocket.model.FaultFields; +import org.onap.ransim.websocket.model.FmMessage; +import org.onap.ransim.websocket.model.Measurement; +import org.onap.ransim.websocket.model.PmMessage; +import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.google.gson.Gson; + +@Service +public class RansimPciHandler { + + static Logger log = Logger.getLogger(RansimPciHandler.class + .getName()); + + @Autowired + RansimRepositoryService ransimRepo ; + + @Autowired + RansimControllerServices rscServices; + + @Autowired + RANSliceConfigService ranSliceConfigService; + + static Map globalFmCellIdUuidMap = new ConcurrentHashMap(); + static Map globalPmCellIdUuidMap = new ConcurrentHashMap(); + + Set cellsWithIssues = new HashSet<>(); + + List pmParameters = new ArrayList(); + int next = 0; + + + + public FmAlarmInfo setCollisionConfusionFromFile(String cellNodeId) { + + FmAlarmInfo result = new FmAlarmInfo(); + + try { + + boolean collisionDetected = false; + boolean confusionDetected = false; + List nbrPcis = new ArrayList(); + List ConfusionPcis = new ArrayList(); + int collisionCount = 0; + int confusionCount = 0; + CellDetails currentCell = ransimRepo.getCellDetail(cellNodeId); + log.info("Setting confusion/collision for Cell :" + cellNodeId); + + GetNeighborList cellNbrDetails = generateNeighborList(cellNodeId); + + for (CellDetails firstLevelNbr : cellNbrDetails.getCellsWithHo()) { + if (nbrPcis + .contains((Long)firstLevelNbr.getPhysicalCellId())) { + confusionDetected = true; + if (ConfusionPcis.contains(firstLevelNbr + .getPhysicalCellId())) { + confusionCount++; + } else { + ConfusionPcis.add(firstLevelNbr.getPhysicalCellId()); + confusionCount = confusionCount + 2; + } + + } else { + nbrPcis.add((Long)firstLevelNbr.getPhysicalCellId()); + } + + if (currentCell.getPhysicalCellId() == firstLevelNbr + .getPhysicalCellId()) { + collisionDetected = true; + collisionCount++; + } + } + + currentCell.setPciCollisionDetected(collisionDetected); + currentCell.setPciConfusionDetected(confusionDetected); + + if (!currentCell.isPciCollisionDetected() + && !currentCell.isPciConfusionDetected()) { + currentCell.setColor("#BFBFBF"); // GREY - No Issues + result.setProblem("No Issues"); + } else if (currentCell.isPciCollisionDetected() + && currentCell.isPciConfusionDetected()) { + currentCell.setColor("#C30000"); // BROWN - Cell has both + // collision & confusion + result.setProblem("CollisionAndConfusion"); + + } else if (currentCell.isPciCollisionDetected()) { + currentCell.setColor("#FF0000"); // RED - Cell has collision + result.setProblem("Collision"); + + } else if (currentCell.isPciConfusionDetected()) { + currentCell.setColor("#E88B00"); // ORANGE - Cell has confusion + result.setProblem("Confusion"); + + } else { + currentCell.setColor("#BFBFBF"); // GREY - No Issues + result.setProblem("No Issues"); + } + + result.setCollisionCount("" + collisionCount); + result.setConfusionCount("" + confusionCount); + + ransimRepo.mergeCellDetails(currentCell); + + return result; + + } catch (Exception e2) { + log.info("setCollisionConfusionFromFile :", e2); + + return null; + } + + } + + /** + * Generates separate list of neighbors with and without hand-off for a + * cell. + * + * @param nodeId + * Node Id of cell for which the neighbor list is generated + * @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 cellsWithNoHO = new ArrayList(); + List cellsWithHO = new ArrayList(); + + List 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; + } + } + + public void checkCollisionAfterModify() { + try { + List checkCollisionConfusion = ransimRepo.getCellsWithCollisionOrConfusion(); + + for (int i = 0; i < checkCollisionConfusion.size(); i++) { + log.info(checkCollisionConfusion.get(i).getNodeId()); + setCollisionConfusionFromFile(checkCollisionConfusion.get(i) + .getNodeId()); + } + } catch (Exception eu) { + log.info("checkCollisionAfterModify", eu); + } + } + + /** + * It updates the cell with its new neighbor list and PCI and updates the + * change in a database. + * + * @param nodeId + * node Id of the cell + * @param physicalCellId + * PCI number of the cell + * @param newNbrs + * List of new neighbors for the cell + * @param source + * The source from which cell modification has been triggered + * @return returns success or failure message + */ + public int modifyCellFunction(String nodeId, long physicalCellId, + List newNbrs, String source) { + + int result = 111; + + log.info("modifyCellFunction nodeId:" + nodeId + ", physicalCellId:" + + physicalCellId); + CellDetails modifyCell = ransimRepo.getCellDetail(nodeId); + + if (modifyCell != null) { + if (physicalCellId < 0 + || physicalCellId > RansimControllerServices.maxPciValueAllowed) { + log.info("NewPhysicalCellId is empty or invalid"); + result = 400; + } else { + long oldPciId = modifyCell.getPhysicalCellId(); + if (physicalCellId != oldPciId) { + updatePciOperationsTable(nodeId, source, physicalCellId, + oldPciId); + + modifyCell.setPhysicalCellId(physicalCellId); + ransimRepo.mergeCellDetails(modifyCell); + } + + CellNeighbor neighbors = ransimRepo.getCellNeighbor(nodeId); + List oldNbrList = new ArrayList( + neighbors.getNeighborList()); + List oldNbrListWithHo = new ArrayList(); + + for (NeighborDetails cell : oldNbrList) { + if (!cell.isBlacklisted()) { + oldNbrListWithHo.add(cell); + } + } + + boolean flag = false; + + List addedNbrs = new ArrayList(); + List deletedNbrs = new ArrayList(); + + String nbrsDel = ""; + + List oldNbrsArr = new ArrayList(); + for (NeighborDetails cell : oldNbrListWithHo) { + oldNbrsArr.add(cell.getNeigbor().getNeighborCell()); + } + + List newNbrsArr = new ArrayList(); + for (NeighborDetails cell : newNbrs) { + newNbrsArr.add(cell.getNeigbor().getNeighborCell()); + } + + for (NeighborDetails cell : oldNbrListWithHo) { + + if (!newNbrsArr.contains(cell.getNeigbor() + .getNeighborCell())) { + if (!flag) { + flag = true; + } + deletedNbrs.add(cell); + if (nbrsDel == "") { + nbrsDel = cell.getNeigbor().getNeighborCell(); + } else { + nbrsDel += "," + + cell.getNeigbor().getNeighborCell(); + } + log.info("deleted cell: " + + cell.getNeigbor().getNeighborCell() + + cell.isBlacklisted()); + + } + } + + String nbrsAdd = ""; + + for (NeighborDetails cell : newNbrs) { + if (cell.isBlacklisted()) { + addedNbrs.add(cell); + } else { + if (!oldNbrsArr.contains(cell.getNeigbor() + .getNeighborCell())) { + addedNbrs.add(cell); + if (nbrsAdd == "") { + nbrsAdd = cell.getNeigbor().getNeighborCell(); + } else { + nbrsAdd += "," + + cell.getNeigbor().getNeighborCell(); + } + log.info("added cell: " + + cell.getNeigbor().getNeighborCell() + + cell.isBlacklisted()); + } + } + + } + List newNeighborList = new ArrayList( + oldNbrList); + for (NeighborDetails cell : deletedNbrs) { + NeighborDetails removeHo = new NeighborDetails( + cell.getNeigbor(), true); + ransimRepo.mergeNeighborDetails(removeHo); + newNeighborList.add(removeHo); + } + + for (NeighborDetails cell : addedNbrs) { + ransimRepo.mergeNeighborDetails(cell); + newNeighborList.add(cell); + } + + if (!flag) { + if (newNbrs.size() != oldNbrList.size()) { + flag = true; + } + } + + if (flag) { + updateNbrsOperationsTable(nodeId, source, nbrsAdd, nbrsDel); + } + + if (newNbrs != null) { + neighbors.getNeighborList().clear(); + Set updatedNbrList = new HashSet( + newNeighborList); + neighbors.setNeighborList(updatedNbrList); + ransimRepo.mergeCellNeighbor(neighbors); + } + + generateFmData(source, modifyCell, newNeighborList); + + result = 200; + } + + + } else { + result = 400; + } + + return result; + } + + public void checkCellsWithIssue() { + + + try { + + for (String id : cellsWithIssues) { + CellDetails currentCell = ransimRepo.getCellDetail(id); + FmMessage fmDataMessage = new FmMessage(); + List data = new ArrayList(); + + if (!currentCell.isPciCollisionDetected()) { + if (!currentCell.isPciConfusionDetected()) { + + cellsWithIssues.remove(id); + CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); + FaultFields faultFields = new FaultFields(); + + commonEventHeader.setStartEpochMicrosec(System + .currentTimeMillis() * 1000); + commonEventHeader + .setSourceName(currentCell.getNodeId()); + commonEventHeader.setReportingEntityName(currentCell + .getServerId()); + String uuid = globalFmCellIdUuidMap.get(currentCell + .getNodeId()); + commonEventHeader.setSourceUuid(uuid); + + faultFields + .setAlarmCondition("RanPciCollisionConfusionOccurred"); + faultFields.setEventSeverity("NORMAL"); + faultFields.setEventSourceType("other"); + faultFields.setSpecificProblem("Problem Solved"); + + commonEventHeader.setLastEpochMicrosec(System + .currentTimeMillis() * 1000); + + EventFm event = new EventFm(); + event.setCommonEventHeader(commonEventHeader); + event.setFaultFields(faultFields); + + data.add(event); + } + } + + fmDataMessage.setFmEventList(data); + + if (!data.isEmpty()) { + sendFmData(currentCell.getServerId(), fmDataMessage); + } + + } + + } catch (Exception eu) { + log.error("Exception:", eu); + } + } + + public void updatePciOperationsTable(String nodeId, String source, long physicalCellId, long oldPciId) { + + OperationLog operationLog = new OperationLog(); + + operationLog.setNodeId(nodeId); + operationLog.setFieldName("PCID"); + operationLog.setOperation("Modify"); + operationLog.setSource(source); + operationLog.setTime(System.currentTimeMillis()); + operationLog.setMessage("PCID value changed from " + oldPciId + " to " + physicalCellId); + ransimRepo.mergeOperationLog(operationLog); + } + + public void updateNbrsOperationsTable(String nodeId, String source, String addedNbrs, String deletedNbrs) { + + OperationLog operationLogNbrChng = new OperationLog(); + operationLogNbrChng.setNodeId(nodeId); + operationLogNbrChng.setFieldName("Neighbors"); + operationLogNbrChng.setOperation("Modify"); + operationLogNbrChng.setSource(source); + + log.info(" Neighbors added " + addedNbrs + "."); + log.info(" Neighbors removed " + deletedNbrs + "."); + String message = ""; + if(!addedNbrs.equals("")){ + message += " Neighbors added " + addedNbrs + "." ; + } + + if(!deletedNbrs.equals("")){ + message += " Neighbors removed " + deletedNbrs + "." ; + } + + operationLogNbrChng.setMessage(message); + operationLogNbrChng.setTime(System.currentTimeMillis()); + ransimRepo.mergeOperationLog(operationLogNbrChng); + } + + /** + * Sends PM message to the netconf agent through the websocket server. + * + * @param serverId + * Netconf agent - Server ID to which the message is sent. + * @param pmMessage + * PM message to be sent. + */ + void sendPmdata(String serverId, String pmMessage) { + + log.info("Sending PM message to netconf agent"); + + String ipPort = RansimControllerServices.serverIdIpPortMapping.get(serverId); + + if (ipPort != null && !ipPort.trim().equals("")) { + + if (ipPort != null && !ipPort.trim().equals("")) { + + Session clSess = RansimControllerServices.webSocketSessions.get(ipPort); + log.info("PM message. Netconf agent IP:" + ipPort); + if (clSess != null) { + RansimWebSocketServer.sendPmMessage(pmMessage, clSess); + log.info("Pm Data jsonStr: " + pmMessage); + log.info("PM message sent to netconf agent"); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("Pm message not sent, ipPort is null"); + } + } else { + + log.info("Pm message not sent, ipPort is null. Server Id: " + + serverId); + } + + } + + /** + * + * Reads the values PM parameter values from a dump file. + * + */ + public void readPmParameters() { + + File dumpFile = null; + PmDataDump pmDump = null; + String jsonString = ""; + dumpFile = new File("PM_Kpi_Data.json"); + + BufferedReader br = null; + + try { + log.info("Reading dump file"); + br = new BufferedReader(new FileReader(dumpFile)); + + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + jsonString = sb.toString(); + + pmDump = new Gson().fromJson(jsonString, PmDataDump.class); + log.info("Dump value: " + + pmDump.getKpiDump().get(0).getParameter1()); + pmParameters = new ArrayList(pmDump.getKpiDump()); + + } catch (Exception eu) { + log.info("Exception: ", eu); + } + } + + private static String getUuid() { + return UUID.randomUUID().toString(); + } + + /** + * Sets values for all the parameters in the PM message + * + * @param nodeIdBad + * List of node Ids with bad performance values + * @param nodeIdPoor + * List of node Ids with poor performance values + * @return It returns the pm message + */ + @Transactional + public List generatePmData(String nodeIdBad, String nodeIdPoor) { + + List result = new ArrayList<>(); + + String parameter1 = ""; + String successValue1 = ""; + String badValue1 = ""; + String poorValue1 = ""; + String parameter2 = ""; + String successValue2 = ""; + String badValue2 = ""; + String poorValue2 = ""; + + try { + + if (next >= pmParameters.size()) { + next = 0; + log.info("next : " + next); + } + try { + log.info("next : " + next); + parameter1 = pmParameters.get(next).getParameter1(); + successValue1 = pmParameters.get(next).getSuccessValue1(); + badValue1 = pmParameters.get(next).getBadValue1(); + poorValue1 = pmParameters.get(next).getPoorValue1(); + parameter2 = pmParameters.get(next).getParameter2(); + successValue2 = pmParameters.get(next).getSuccessValue2(); + badValue2 = pmParameters.get(next).getBadValue2(); + poorValue2 = pmParameters.get(next).getPoorValue2(); + next++; + } catch (Exception e) { + log.info("Exception: ", e); + } + + List cnl = ransimRepo.getNetconfServersList(); + log.debug("obtained data from db"); + String[] cellIdsBad = null; + String[] cellIdsPoor = null; + Set nodeIdsBad = new HashSet(); + Set nodeIdsPoor = new HashSet(); + + if (nodeIdBad != null) { + cellIdsBad = nodeIdBad.split(","); + for (int a = 0; a < cellIdsBad.length; a++) { + nodeIdsBad.add(cellIdsBad[a].trim()); + } + } + if (nodeIdPoor != null) { + cellIdsPoor = nodeIdPoor.split(","); + for (int a = 0; a < cellIdsPoor.length; a++) { + nodeIdsPoor.add(cellIdsPoor[a].trim()); + } + } + + for (int i = 0; i < cnl.size(); i++) { + + long startTime = System.currentTimeMillis(); + List cellList = new ArrayList(cnl + .get(i).getCells()); + List data = new ArrayList(); + + 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 = new ArrayList(); + 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 hashMap = new HashMap(); + 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 hashMap = new HashMap(); + + 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; + } + + /** + * Sets the value for all fields in the FM data for individual cell. + * + * @param networkId + * Network Id of the cell + * @param ncServer + * Server Id of the cell + * @param cellId + * Node Id of the cell + * @param issue + * Contains the collision/confusion details of the cess + * @return returns EventFm object, with all the necessary parameters. + */ + public static EventFm setEventFm(String networkId, String ncServer, + String cellId, FmAlarmInfo issue) { + + log.info("Inside generate FmData"); + EventFm event = new EventFm(); + + try { + + CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); + FaultFields faultFields = new FaultFields(); + + commonEventHeader + .setStartEpochMicrosec(System.currentTimeMillis() * 1000); + commonEventHeader.setSourceName(cellId); + commonEventHeader.setReportingEntityName(ncServer); + + String uuid = globalFmCellIdUuidMap.get(cellId); + if (uuid == null) { + uuid = getUuid(); + globalFmCellIdUuidMap.put(cellId, uuid); + } + commonEventHeader.setSourceUuid(uuid); + + if (issue.getProblem().equals("Collision") + || issue.getProblem().equals("Confusion") + || issue.getProblem().equals("CollisionAndConfusion")) { + faultFields + .setAlarmCondition("RanPciCollisionConfusionOccurred"); + faultFields.setEventSeverity("CRITICAL"); + faultFields.setEventSourceType("other"); + faultFields.setSpecificProblem(issue.getProblem()); + + Map alarmAdditionalInformation = new HashMap(); + alarmAdditionalInformation.put("networkId", networkId); + alarmAdditionalInformation.put("collisions", + issue.getCollisionCount()); + alarmAdditionalInformation.put("confusions", + issue.getConfusionCount()); + + faultFields + .setAlarmAdditionalInformation(alarmAdditionalInformation); + + } + commonEventHeader + .setLastEpochMicrosec(System.currentTimeMillis() * 1000); + + event.setCommonEventHeader(commonEventHeader); + event.setFaultFields(faultFields); + + } catch (Exception e) { + log.info("Exception: ", e); + } + + return event; + + } + + /** + * It checks if the cell or any of its neighbors have collision/confusion + * issue. If there are any issues it generates the FM data for the entire + * cluster + * + * @param source + * The source from which the cell modification has been + * triggered. + * @param cell + * Details of the given cell. + * @param newNeighborList + * Neighbor list of the given cell. + */ + public void generateFmData(String source, CellDetails cell, + List newNeighborList) { + + List listCellIssue = new ArrayList(); + Set ncs = new HashSet<>(); + log.info("Generating Fm data"); + FmAlarmInfo op1 = setCollisionConfusionFromFile(cell.getNodeId()); + + if (source.equals("GUI")) { + if (op1.getProblem().equals("CollisionAndConfusion") + || op1.getProblem().equals("Collision") + || op1.getProblem().equals("Confusion")) { + log.info("op1: " + op1); + EventFm lci = setEventFm(cell.getNetworkId(), + cell.getServerId(), cell.getNodeId(), op1); + listCellIssue.add(lci); + ncs.add(cell.getServerId()); + log.info("Generating Fm data for: " + cell.getNodeId()); + } + } + + for (NeighborDetails cd : newNeighborList) { + FmAlarmInfo op2 = setCollisionConfusionFromFile(cd.getNeigbor() + .getNeighborCell()); + CellDetails nbrCell = ransimRepo.getCellDetail(cd.getNeigbor() + .getNeighborCell()); + + if (source.equals("GUI")) { + if (op2.getProblem().equals("CollisionAndConfusion") + || op2.getProblem().equals("Collision") + || op2.getProblem().equals("Confusion")) { + EventFm lci = setEventFm(nbrCell.getNetworkId(), + nbrCell.getServerId(), nbrCell.getNodeId(), op2); + log.info("FmData added:" + nbrCell.getNodeId()); + listCellIssue.add(lci); + ncs.add(nbrCell.getServerId()); + log.info("Generating Fm data for: " + nbrCell.getNodeId()); + } + } + + } + + if (source.equals("GUI")) { + for (String nc : ncs) { + + FmMessage fmDataMessage = new FmMessage(); + List data = new ArrayList(); + log.info("listCellIssue.size(): " + listCellIssue.size()); + for (EventFm cellIssue : listCellIssue) { + if (cellIssue.getCommonEventHeader() + .getReportingEntityName().equals(nc)) { + data.add(cellIssue); + if (!cellsWithIssues.contains(cellIssue + .getCommonEventHeader().getSourceName())) { + cellsWithIssues.add(cellIssue + .getCommonEventHeader().getSourceName()); + } + + } + } + log.info("data.size(): " + data.size()); + + if (data.size() > 0) { + fmDataMessage.setFmEventList(data); + log.info("Sending FM message: "); + sendFmData(nc, fmDataMessage); + } + + } + } + + } + + /** + * Sends the FM data message to the netconf agent through the ransim + * websocket server. + * + * @param serverId + * server id of the netconf agent + * @param fmDataMessage + * FM message to be sent + */ + public void sendFmData(String serverId, FmMessage fmDataMessage) { + + log.info("inside sendFmData"); + Gson gson = new Gson(); + String jsonStr = gson.toJson(fmDataMessage); + + log.info("Fm Data jsonStr: " + jsonStr); + + String ipPort = RansimControllerServices.serverIdIpPortMapping.get(serverId); + + if (ipPort != null && !ipPort.trim().equals("")) { + + log.info("Connection estabilished with ip: " + ipPort); + if (ipPort != null && !ipPort.trim().equals("")) { + Session clSess = RansimControllerServices.webSocketSessions.get(ipPort); + if (clSess != null) { + log.info("FM message sent."); + RansimWebSocketServer.sendFmMessage(jsonStr, clSess); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("No client for " + serverId); + } + } else { + log.info("No client for "); + } + + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java new file mode 100644 index 0000000..6cb39c1 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java @@ -0,0 +1,265 @@ +/*- + }* ============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.rest.api.handler; + +import java.io.File; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Random; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.websocket.Session; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RansimRepositoryService; +import org.onap.ransim.rest.web.mapper.GNBCUCPModel; +import org.onap.ransim.rest.web.mapper.NRCellCUModel; +import org.onap.ransim.rest.web.mapper.PLMNInfoModel; +import org.onap.ransim.rest.xml.models.*; +import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.onap.ransim.websocket.model.SlicingPmMessage; + +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; +import com.google.gson.Gson; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +@Service +public class RansimSlicingHandler { + + static Logger log = Logger.getLogger(RansimSlicingHandler.class + .getName()); + + @Autowired + RansimRepositoryService ransimRepo ; + + @Autowired + RansimControllerServices rscServices; + + @Autowired + RANSliceConfigService ranSliceConfigService; + + + public List generateIntelligentSlicingPmData(long startTime, HashMap> taCells) { + List result = new ArrayList(); + try { + String requestUrl = "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/cucp-list"; + List gnbcucpModelList = sendGetRequestToConfigDb(requestUrl).getBody(); + long peakEndTime = System.currentTimeMillis() + 360000; + for (int i = 0; i < gnbcucpModelList.size(); i++) { + String gNBName = gnbcucpModelList.get(i).getgNBCUName(); + LocalDateTime beginTime = LocalDateTime.now(); + String beginTimeString = beginTime.toString(); + SlicingPmMessage pmMessage = new SlicingPmMessage(); + pmMessage.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + pmMessage.setSourceName(gNBName); + MeasCollec measCollec = new MeasCollec(beginTimeString); + FileSender fileSender = new FileSender(gNBName); + FileHeader fileHeader = new FileHeader("Prefix", "Acme Ltd", "32.435 V10.0", measCollec, fileSender); + Random r = new Random(); + int jobId = r.nextInt((9999 - 1000) + 1) + 1000; + Job job = new Job(String.valueOf(jobId)); + ReportingPeriod reportingPeriod = new ReportingPeriod("PT900S"); + List measTypeList = new ArrayList(); + int numberOfNssaiType = 1; + HashMap nssaiInfoMap = new HashMap(); + for (NRCellCUModel nRCellCUModel : gnbcucpModelList.get(i).getCellCUList()) { + for (PLMNInfoModel pLMNInfoModel : nRCellCUModel.getpLMNInfoList()) { + if (pLMNInfoModel.getsNSSAI().getStatus().equalsIgnoreCase("active")) { + nssaiInfoMap.put(pLMNInfoModel.getsNSSAI().getsNSSAI(), + pLMNInfoModel.getsNSSAI().getConfigData().getMaxNumberOfConns()); + } + } + } + HashMap nSSAINo = new HashMap(); + for (java.util.Map.Entry map : nssaiInfoMap.entrySet()) { + String nssai = map.getKey(); + MeasType mesType1 = new MeasType("SM.PDUSessionSetupReq." + nssai, numberOfNssaiType++); + MeasType mesType2 = new MeasType("SM.PDUSessionSetupSucc." + nssai, numberOfNssaiType++); + measTypeList.add(mesType1); + measTypeList.add(mesType2); + if (numberOfNssaiType == 3) { + MeasType mesTypeFail = new MeasType("SM.PDUSessionSetupFail." + "0", 3); + measTypeList.add(mesTypeFail); + numberOfNssaiType++; + } + nSSAINo.put(nssai,mesType1.getP()); + } + + List measValueList = new ArrayList(); + + for (NRCellCUModel nRCellCUModel : gnbcucpModelList.get(i).getCellCUList()) { + List resultList = new ArrayList(); + int noOfRequestedSessions = 0; + int successfulSessions = 0; + int failedSessions = 0; + int configData = 0; + double rNumForTotalReq = 0; + int numberOfNssaiValue = 1; //change + for (PLMNInfoModel pLMNInfoModel : nRCellCUModel.getpLMNInfoList()) { + for (java.util.Map.Entry nssaiMap : nSSAINo.entrySet()) { + if(nssaiMap.getKey().equals(pLMNInfoModel.getsNSSAI().getsNSSAI())) { + configData = pLMNInfoModel.getsNSSAI().getConfigData().getMaxNumberOfConns(); + noOfRequestedSessions = 0; + successfulSessions = 0; + for (java.util.Map.Entry> taCellMap : taCells.entrySet()) { + for(String cell : taCellMap.getValue()) { + if(Integer.parseInt(cell) == nRCellCUModel.getCellLocalId().intValue()) { + long end = (System.currentTimeMillis()); + if(peakEndTime>end) { + if(taCellMap.getKey().equalsIgnoreCase("TA1") || taCellMap.getKey().equalsIgnoreCase("TA3")) { + rNumForTotalReq = 1.4 + (new Random().nextDouble() * (1.0 - 1.4)); + } else { + rNumForTotalReq = 0.6 + (new Random().nextDouble() * (0.3 - 0.6)); + } + } + else { + rNumForTotalReq = 0.7 + (new Random().nextDouble() * (0.3 - 0.7)); + } + } + } + } + + double rNumForFs = 0.10 + (new Random().nextDouble() * (0.05 - 0.10)); + double rNumForSs = 0.75 + (new Random().nextDouble()* (0.75 - 0.90)); + noOfRequestedSessions = (int) (configData * rNumForTotalReq); + successfulSessions = (int) (noOfRequestedSessions * rNumForSs); + failedSessions += noOfRequestedSessions - successfulSessions; + numberOfNssaiValue = nssaiMap.getValue(); + Result result1 = new Result(numberOfNssaiValue++, noOfRequestedSessions); + Result result2 = new Result(numberOfNssaiValue++, successfulSessions); + resultList.add(result1); + resultList.add(result2); + if (numberOfNssaiValue == 3) { + numberOfNssaiValue++; + } + if(nRCellCUModel.getpLMNInfoList().indexOf(pLMNInfoModel)+1 == nRCellCUModel.getpLMNInfoList().size()) + { + failedSessions -= failedSessions * rNumForFs; + Result result3 = new Result(3, failedSessions); + resultList.add(result3); + } + } + } + + } + + MeasValue measValue = new MeasValue(nRCellCUModel.getCellLocalId(), + resultList, false); + measValueList.add(measValue); + } + + ManagedElement managedElement = new ManagedElement("r0.1", gNBName); + LocalDateTime grabularityEndTime = LocalDateTime.now(); + String grabularityEndTimeString = grabularityEndTime.toString(); + GranularityPeriod granularityPeriod = new GranularityPeriod(grabularityEndTimeString, "PT900S"); + MeasInfo measInfo = new MeasInfo("measInfoIsVal", job, granularityPeriod, reportingPeriod, measTypeList, + measValueList); + List measInfoList = new ArrayList(); + measInfoList.add(measInfo); + MeasData measData = new MeasData(managedElement, measInfoList); + List measDataList = new ArrayList(); + measDataList.add(measData); + LocalDateTime endTime = LocalDateTime.now(); + String endTimeString = endTime.toString(); + pmMessage.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + MeasCollecEnd measCollecEnd = new MeasCollecEnd(endTimeString); + FileFooter fileFooter = new FileFooter(measCollecEnd); + MeasCollecFile measCollecFile = new MeasCollecFile(fileHeader, measDataList, fileFooter, + "http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"); + String startDate = beginTimeString.replace(':', '-'); + String endDate = endTimeString.replace(':', '-'); + String fileName = "A" + startDate + "-"+ endDate + "-" + String.valueOf(jobId) + "-" + gNBName+ ".xml"; + pmMessage.setFileName(fileName); + Gson gson = new Gson(); + String pmData = gson.toJson(measCollecFile); + pmMessage.setPmData(pmData); + sendIntelligentSlicingPmData(pmMessage); + } + } + catch (Exception e) { + System.out.println("Exception: " + e); + } + return result; +} + +public static ResponseEntity> sendGetRequestToConfigDb(String requestUrl) { + + HttpHeaders headers = new HttpHeaders(); + log.info("sending..."); + headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); + HttpEntity requestEntity = new HttpEntity<>(headers); + try { + RestTemplate restTemplate = new RestTemplate(); + return restTemplate.exchange(requestUrl, HttpMethod.GET, requestEntity, + new ParameterizedTypeReference>() { + }); + } + catch (Exception e) { + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } +} + + +public void sendIntelligentSlicingPmData( SlicingPmMessage pmMessage) { + + log.info("inside sendIntelligentSlicingPmData"); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(pmMessage); + + log.info("IntelligentSlicingPmData " + jsonStr); + + String ipPort = RansimControllerServices.serverIdIpPortMapping.get(pmMessage.getSourceName()); + + if (ipPort != null && !ipPort.trim().equals("")) { + + log.info("Connection estabilished with ip: " + ipPort); + if (ipPort != null && !ipPort.trim().equals("")) { + Session clSess = RansimControllerServices.webSocketSessions.get(ipPort); + if (clSess != null) { + log.info("PM Data message sent."); + RansimWebSocketServer.sendIntelligentSlicingPmData(jsonStr, clSess); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("No client for this serverId"); + } + } else { + log.info("No client for "); + } + + } +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java index 3d9a70c..046d64a 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java @@ -23,42 +23,40 @@ package org.onap.ransim.rest.api.models; import java.util.List; public class CellData { - - private CellInfo Cell; - private List neighbor; - - public CellData() { - super(); - } - - /** - * Constructor with all parameters - * - * @param cell - * Contains cell details. - * @param neighbor - * Contains list of neighbor details. - */ - public CellData(CellInfo cell, List neighbor) { - super(); - Cell = cell; - this.neighbor = neighbor; - } - - public CellInfo getCell() { - return Cell; - } - - public void setCell(CellInfo cell) { - Cell = cell; - } - - public List getNeighbor() { - return neighbor; - } - - public void setNeighbor(List neighbor) { - this.neighbor = neighbor; - } - + + private CellInfo Cell; + private List neighbor; + + public CellData() { + super(); + } + + /** + * Constructor with all parameters + * + * @param cell Contains cell details. + * @param neighbor Contains list of neighbor details. + */ + public CellData(CellInfo cell, List neighbor) { + super(); + Cell = cell; + this.neighbor = neighbor; + } + + public CellInfo getCell() { + return Cell; + } + + public void setCell(CellInfo cell) { + Cell = cell; + } + + public List getNeighbor() { + return neighbor; + } + + public void setNeighbor(List neighbor) { + this.neighbor = neighbor; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java index 697744c..1c393d4 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java @@ -27,247 +27,226 @@ import javax.persistence.Table; @Entity @Table(name = "CellDetails") -public class CellDetails implements Comparable{ - - private String networkId; - private String nodeId; - private long physicalCellId; - private String nodeName; - private String nodeType; - private boolean pciCollisionDetected; - private boolean pciConfusionDetected; - private float gridX; - private float gridY; - private float screenX; - private float screenY; - private String latitude; - private String longitude; - private String serverId; - private int sectorNumber = 0; - private String color; - - /** - * Constructor with cell Id, pci and server Id for test cases. - * - * @param nodeId - * Node Id of Cell - * @param physicalCellId - * Pci value of the cell. - * @param serverId - * Server Id of the cell. - */ - public CellDetails(String nodeId, long physicalCellId, String serverId) { - super(); - this.nodeId = nodeId; - this.physicalCellId = physicalCellId; - this.serverId = serverId; - } - - /** - * A constructor for CellDetails( Database to store cell details). - * - * @param networkId - * network Id of the cell - * @param nodeId - * node Id of the cell - * @param physicalCellId - * PCI number of the cell - * @param nodeName - * node name - * @param nodeType - * node type based on the cluster - * @param pciCollisionDetected - * Checks if the cell has collision - * @param pciConfusionDetected - * Checks if the cell has confusion - * - * @param gridX - * -- - * @param gridY - * -- - * @param screenX - * x coordinate of the cell in the GUI - * @param screenY - * y coordinate of the cell in the GUI - * @param latitude - * latitude of the cell node - * @param longitude - * longitude of the cell node - * @param serverId - * server Id of the netconf server it belongs to - * @param sectorNumber - * sector number of the cell - * @param color - * color of the cell in the GUI - */ - public CellDetails(String networkId, String nodeId, long physicalCellId, String nodeName, - String nodeType, boolean pciCollisionDetected, boolean pciConfusionDetected, - float gridX, float gridY, float screenX, float screenY, String latitude, - String longitude, String serverId, int sectorNumber, String color) { - super(); - this.networkId = networkId; - this.nodeId = nodeId; - this.physicalCellId = physicalCellId; - this.nodeName = nodeName; - this.nodeType = nodeType; - this.pciCollisionDetected = pciCollisionDetected; - this.pciConfusionDetected = pciConfusionDetected; - - this.gridX = gridX; - this.gridY = gridY; - this.screenX = screenX; - this.screenY = screenY; - this.latitude = latitude; - this.longitude = longitude; - this.serverId = serverId; - this.sectorNumber = sectorNumber; - this.color = color; - } - - public CellDetails() { - super(); - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - @Id - @Column(name = "nodeId", unique = true, nullable = false, length = 50) - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public long getPhysicalCellId() { - return physicalCellId; - } - - public void setPhysicalCellId(long physicalCellId) { - this.physicalCellId = physicalCellId; - } - - public String getNodeName() { - return nodeName; - } - - public void setNodeName(String nodeName) { - this.nodeName = nodeName; - } - - public String getNodeType() { - return nodeType; - } - - public void setNodeType(String nodeType) { - this.nodeType = nodeType; - } - - 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 float getGridX() { - return gridX; - } - - public void setGridX(float gridX) { - this.gridX = gridX; - } - - public float getGridY() { - return gridY; - } - - public void setGridY(float gridY) { - this.gridY = gridY; - } - - public float getScreenX() { - return screenX; - } - - public void setScreenX(float screenX) { - this.screenX = screenX; - } - - public float getScreenY() { - return screenY; - } - - public void setScreenY(float screenY) { - this.screenY = screenY; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public int getSectorNumber() { - return sectorNumber; - } - - public void setSectorNumber(int sectorNumber) { - this.sectorNumber = sectorNumber; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public String getLatitude() { - return latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getLongitude() { - return longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - @Override - public String toString() { - return "Cell Details [networkId=" + networkId + ", nodeId=" + nodeId + ", physicalCellId=" - + physicalCellId + ", nodeName=" + nodeName + ", nodeType=" + nodeType - + ", pciCollisionDetected=" + pciCollisionDetected + ", pciConfusionDetected=" - + pciConfusionDetected + "]"; - } - - @Override - public int compareTo(CellDetails cd) { - return this.getNodeId().compareTo(cd.getNodeId()); - } +public class CellDetails implements Comparable { + + private String networkId; + private String nodeId; + private long physicalCellId; + private String nodeName; + private String nodeType; + private boolean pciCollisionDetected; + private boolean pciConfusionDetected; + private float gridX; + private float gridY; + private float screenX; + private float screenY; + private String latitude; + private String longitude; + private String serverId; + private int sectorNumber = 0; + private String color; + + /** + * Constructor with cell Id, pci and server Id for test cases. + * + * @param nodeId Node Id of Cell + * @param physicalCellId Pci value of the cell. + * @param serverId Server Id of the cell. + */ + public CellDetails(String nodeId, long physicalCellId, String serverId) { + super(); + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + this.serverId = serverId; + } + + /** + * A constructor for CellDetails( Database to store cell details). + * + * @param networkId network Id of the cell + * @param nodeId node Id of the cell + * @param physicalCellId PCI number of the cell + * @param nodeName node name + * @param nodeType node type based on the cluster + * @param pciCollisionDetected Checks if the cell has collision + * @param pciConfusionDetected Checks if the cell has confusion + * + * @param gridX -- + * @param gridY -- + * @param screenX x coordinate of the cell in the GUI + * @param screenY y coordinate of the cell in the GUI + * @param latitude latitude of the cell node + * @param longitude longitude of the cell node + * @param serverId server Id of the netconf server it belongs to + * @param sectorNumber sector number of the cell + * @param color color of the cell in the GUI + */ + public CellDetails(String networkId, String nodeId, long physicalCellId, String nodeName, String nodeType, + boolean pciCollisionDetected, boolean pciConfusionDetected, float gridX, float gridY, float screenX, + float screenY, String latitude, String longitude, String serverId, int sectorNumber, String color) { + super(); + this.networkId = networkId; + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + this.nodeName = nodeName; + this.nodeType = nodeType; + this.pciCollisionDetected = pciCollisionDetected; + this.pciConfusionDetected = pciConfusionDetected; + + this.gridX = gridX; + this.gridY = gridY; + this.screenX = screenX; + this.screenY = screenY; + this.latitude = latitude; + this.longitude = longitude; + this.serverId = serverId; + this.sectorNumber = sectorNumber; + this.color = color; + } + + public CellDetails() { + super(); + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + @Id + @Column(name = "nodeId", unique = true, nullable = false, length = 50) + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public long getPhysicalCellId() { + return physicalCellId; + } + + public void setPhysicalCellId(long physicalCellId) { + this.physicalCellId = physicalCellId; + } + + public String getNodeName() { + return nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public String getNodeType() { + return nodeType; + } + + public void setNodeType(String nodeType) { + this.nodeType = nodeType; + } + + 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 float getGridX() { + return gridX; + } + + public void setGridX(float gridX) { + this.gridX = gridX; + } + + public float getGridY() { + return gridY; + } + + public void setGridY(float gridY) { + this.gridY = gridY; + } + + public float getScreenX() { + return screenX; + } + + public void setScreenX(float screenX) { + this.screenX = screenX; + } + + public float getScreenY() { + return screenY; + } + + public void setScreenY(float screenY) { + this.screenY = screenY; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public int getSectorNumber() { + return sectorNumber; + } + + public void setSectorNumber(int sectorNumber) { + this.sectorNumber = sectorNumber; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + @Override + public String toString() { + return "Cell Details [networkId=" + networkId + ", nodeId=" + nodeId + ", physicalCellId=" + physicalCellId + + ", nodeName=" + nodeName + ", nodeType=" + nodeType + ", pciCollisionDetected=" + pciCollisionDetected + + ", pciConfusionDetected=" + pciConfusionDetected + "]"; + } + + @Override + public int compareTo(CellDetails cd) { + return this.getNodeId().compareTo(cd.getNodeId()); + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java index e9dbbe0..9a1b8da 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java @@ -21,103 +21,96 @@ package org.onap.ransim.rest.api.models; public class CellInfo { - - private String networkId; - private String nodeId; - private long physicalCellId; - private String pnfName; - private int sectorNumber; - private String latitude; - private String longitude; - - /** - * A constructor for CellInfo. - * - * @param networkId - * network Id of the cell - * @param nodeId - * node Id of the cell - * @param physicalCellId - * PCI number of the cell - * @param pnfName - * netconf server id - * @param sectorNumber - * sector number for the cell - * @param latitude - * latitude of the node - * @param longitude - * longitude of the node - */ - public CellInfo(String networkId, String nodeId, long physicalCellId, - String pnfName, int sectorNumber, String latitude, String longitude) { - super(); - this.networkId = networkId; - this.nodeId = nodeId; - this.physicalCellId = physicalCellId; - this.pnfName = pnfName; - this.sectorNumber = sectorNumber; - this.latitude = latitude; - this.longitude = longitude; - } - - public CellInfo() { - - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public long getPhysicalCellId() { - return physicalCellId; - } - - public void setPhysicalCellId(long physicalCellId) { - this.physicalCellId = physicalCellId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public int getSectorNumber() { - return sectorNumber; - } - - public void setSectorNumber(int sectorNumber) { - this.sectorNumber = sectorNumber; - } - - public String getLatitude() { - return latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getLongitude() { - return longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - + + private String networkId; + private String nodeId; + private long physicalCellId; + private String pnfName; + private int sectorNumber; + private String latitude; + private String longitude; + + /** + * A constructor for CellInfo. + * + * @param networkId network Id of the cell + * @param nodeId node Id of the cell + * @param physicalCellId PCI number of the cell + * @param pnfName netconf server id + * @param sectorNumber sector number for the cell + * @param latitude latitude of the node + * @param longitude longitude of the node + */ + public CellInfo(String networkId, String nodeId, long physicalCellId, String pnfName, int sectorNumber, + String latitude, String longitude) { + super(); + this.networkId = networkId; + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + this.pnfName = pnfName; + this.sectorNumber = sectorNumber; + this.latitude = latitude; + this.longitude = longitude; + } + + public CellInfo() { + + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public long getPhysicalCellId() { + return physicalCellId; + } + + public void setPhysicalCellId(long physicalCellId) { + this.physicalCellId = physicalCellId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public int getSectorNumber() { + return sectorNumber; + } + + public void setSectorNumber(int sectorNumber) { + this.sectorNumber = sectorNumber; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java index aca96ca..f0b9872 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java @@ -24,73 +24,63 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; +import javax.persistence.FetchType; import javax.persistence.OneToMany; import javax.persistence.Table; import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.controller.RansimControllerServices; +import org.onap.ransim.rest.api.controller.RansimController; @Entity @Table(name = "CellNeighbor") public class CellNeighbor { - - @Id - @Column(name = "nodeId", unique = true, nullable = false, length = 52) - private String nodeId; - - /* - * @OneToMany(targetEntity = CellDetails.class) private Set - * neighborList; - */ - - @OneToMany(targetEntity = NeighborDetails.class) - private Set neighborList; - - public CellNeighbor() { - super(); - // TODO Auto-generated constructor stub - } - - public CellNeighbor(String nodeId, Set neighborList) { - super(); - this.nodeId = nodeId; - this.neighborList = neighborList; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public Set getNeighborList() { - return neighborList; - } - - public void setNeighborList(Set neighborList) { - this.neighborList = neighborList; - } - - static Logger log = Logger.getLogger(RansimControllerServices.class.getName()); - - public void display() { - - List iterator = new ArrayList<>(neighborList); - for (int ii = 0; ii < iterator.size(); ii++) { - log.info("neighbors NeighborList: " - + iterator.get(ii).getNeigbor().getSourceCellNodeId() + " " - + iterator.get(ii).getNeigbor().getNeighborCell() + " " - + iterator.get(ii).isBlacklisted()); - } - - } - /* - * public void clearNeighborList() { this.neighborList.; } - */ - + + @Id + @Column(name = "nodeId", unique = true, nullable = false, length = 52) + private String nodeId; + + @OneToMany(targetEntity = NeighborDetails.class,fetch = FetchType.EAGER, cascade = CascadeType.ALL) + private Set neighborList; + + public CellNeighbor() { + super(); + } + + public CellNeighbor(String nodeId, Set neighborList) { + super(); + this.nodeId = nodeId; + this.neighborList = neighborList; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public Set getNeighborList() { + return neighborList; + } + + public void setNeighborList(Set neighborList) { + this.neighborList = neighborList; + } + + static Logger log = Logger.getLogger(RansimController.class.getName()); + + public void display() { + + List iterator = new ArrayList<>(neighborList); + for (int ii = 0; ii < iterator.size(); ii++) { + log.info("neighbors NeighborList: " + iterator.get(ii).getNeigbor().getSourceCellNodeId() + " " + + iterator.get(ii).getNeigbor().getNeighborCell() + " " + iterator.get(ii).isBlacklisted()); + } + + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ConfigData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ConfigData.java new file mode 100644 index 0000000..c75f3e9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ConfigData.java @@ -0,0 +1,21 @@ +package org.onap.ransim.rest.api.models; + +public class ConfigData { + +private int maxNumberOfConns; + +public ConfigData() { +} +public ConfigData(int maxNumberOfConns) { +super(); +this.maxNumberOfConns = maxNumberOfConns; +} + +public int getMaxNumberOfConns() { +return maxNumberOfConns; +} + +public void setMaxNumberOfConns(int maxNumberOfConns) { +this.maxNumberOfConns = maxNumberOfConns; +} +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java index 34e23a5..618facf 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java @@ -23,58 +23,55 @@ package org.onap.ransim.rest.api.models; import java.io.Serializable; public class CreateACellReq implements Serializable { - - private long physicalCellId; - - private int gridX; - private int gridY; - - private static final long serialVersionUID = 3736300675426332512L; - - public CreateACellReq() { - // Default constructor for CreateACellReq - } - - /** - * A constructor for CreateACellReq. - * - * @param physicalCellId - * PCI number of the new cell - * @param gridX - * x coordinate value for the cell - * @param gridY - * y coordinate value for the cell - */ - public CreateACellReq(long physicalCellId, int gridX, int gridY) { - super(); - - this.physicalCellId = physicalCellId; - - this.gridX = gridX; - this.gridY = gridY; - } - - public long getPhysicalCellId() { - return physicalCellId; - } - - public void setPhysicalCellId(long physicalCellId) { - this.physicalCellId = physicalCellId; - } - - public int getGridX() { - return gridX; - } - - public void setGridX(int gridX) { - this.gridX = gridX; - } - - public int getGridY() { - return gridY; - } - - public void setGridY(int gridY) { - this.gridY = gridY; - } + + private long physicalCellId; + + private int gridX; + private int gridY; + + private static final long serialVersionUID = 3736300675426332512L; + + public CreateACellReq() { + // Default constructor for CreateACellReq + } + + /** + * A constructor for CreateACellReq. + * + * @param physicalCellId PCI number of the new cell + * @param gridX x coordinate value for the cell + * @param gridY y coordinate value for the cell + */ + public CreateACellReq(long physicalCellId, int gridX, int gridY) { + super(); + + this.physicalCellId = physicalCellId; + + this.gridX = gridX; + this.gridY = gridY; + } + + public long getPhysicalCellId() { + return physicalCellId; + } + + public void setPhysicalCellId(long physicalCellId) { + this.physicalCellId = physicalCellId; + } + + public int getGridX() { + return gridX; + } + + public void setGridX(int gridX) { + this.gridX = gridX; + } + + public int getGridY() { + return gridY; + } + + public void setGridY(int gridY) { + this.gridY = gridY; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java index a2a01ac..a6a7baf 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java @@ -21,30 +21,29 @@ package org.onap.ransim.rest.api.models; public class DeleteACellReq { - - private String nodeId; - - /** - * A constructor for DeleteACellReq. - * - * @param nodeId - * node Id of the cell to be deleted - */ - public DeleteACellReq(String nodeId) { - super(); - this.nodeId = nodeId; - } - - public DeleteACellReq() { - - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - + + private String nodeId; + + /** + * A constructor for DeleteACellReq. + * + * @param nodeId node Id of the cell to be deleted + */ + public DeleteACellReq(String nodeId) { + super(); + this.nodeId = nodeId; + } + + public DeleteACellReq() { + + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + } 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 6a01498..6b00369 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 @@ -21,54 +21,51 @@ package org.onap.ransim.rest.api.models; public class FmAlarmInfo { - - private String problem; - private String collisionCount; - private String confusionCount; - - public FmAlarmInfo() { - super(); - } - - /** - * Constructor with all fields. - * - * @param problem - * Collision or Confusion - * @param collisionCount - * No of cells that causes collision. - * @param confusionCount - * No od cells that causes confusion. - */ - public FmAlarmInfo(String problem, String collisionCount, String confusionCount) { - super(); - this.problem = problem; - this.collisionCount = collisionCount; - this.confusionCount = confusionCount; - } - - public String getProblem() { - return problem; - } - - public void setProblem(String problem) { - this.problem = problem; - } - - public String getCollisionCount() { - return collisionCount; - } - - public void setCollisionCount(String collisionCount) { - this.collisionCount = collisionCount; - } - - public String getConfusionCount() { - return confusionCount; - } - - public void setConfusionCount(String confusionCount) { - this.confusionCount = confusionCount; - } - + + private String problem; + private String collisionCount; + private String confusionCount; + + public FmAlarmInfo() { + super(); + } + + /** + * Constructor with all fields. + * + * @param problem Collision or Confusion + * @param collisionCount No of cells that causes collision. + * @param confusionCount No od cells that causes confusion. + */ + public FmAlarmInfo(String problem, String collisionCount, String confusionCount) { + super(); + this.problem = problem; + this.collisionCount = collisionCount; + this.confusionCount = confusionCount; + } + + public String getProblem() { + return problem; + } + + public void setProblem(String problem) { + this.problem = problem; + } + + public String getCollisionCount() { + return collisionCount; + } + + public void setCollisionCount(String collisionCount) { + this.collisionCount = collisionCount; + } + + public String getConfusionCount() { + return confusionCount; + } + + public void setConfusionCount(String confusionCount) { + this.confusionCount = confusionCount; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUCPFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUCPFunction.java new file mode 100644 index 0000000..4c5f0af --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUCPFunction.java @@ -0,0 +1,79 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="GNBCUCPFUNCTION") +public class GNBCUCPFunction implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="GNBCUNAME") + private String gNBCUName; + @Column(name="GNBID") + private Integer gNBId; + @Column(name="GNBIDLENGTH") + private Integer gNBIdLength; + @Column(name="PLMNID") + private String pLMNId; + @Column(name="NFTYPE") + private String nFType; + @Column(name="CELLCULIST") + @OneToMany(mappedBy = "gNBCUCPFunction", cascade=CascadeType.ALL) + private List cellCUList; + @ManyToOne//(cascade=CascadeType.ALL) + @JoinColumn(name = "nearrtricid") + private NearRTRIC nearRTRIC; + public String getgNBCUName() { + return gNBCUName; + } + public void setgNBCUName(String gNBCUName) { + this.gNBCUName = gNBCUName; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + public Integer getgNBIdLength() { + return gNBIdLength; + } + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + public String getpLMNId() { + return pLMNId; + } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + public List getCellCUList() { + return cellCUList; + } + public void setCellCUList(List cellCUList) { + this.cellCUList = cellCUList; + } + public NearRTRIC getNearRTRIC() { + return nearRTRIC; + } + public void setNearRTRIC(NearRTRIC nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + public String getnFType() { + return nFType; + } + public void setnFType(String nFType) { + this.nFType = nFType; + } + +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java new file mode 100644 index 0000000..2e5d62b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java @@ -0,0 +1,79 @@ +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.Table; +@Entity +@Table(name="GNBCUUPFUNCTION") +public class GNBCUUPFunction implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="GNBCUUPID") + private Integer gNBCUUPId; + @Column(name="GNBID") + private Integer gNBId; + @Column(name="GNBIDLENGTH") + private Integer gNBIdLength; + //@Column(name="PLMNINFOLIST") + //@OneToMany(mappedBy = "gNBCUUPFunction", cascade={CascadeType.PERSIST,CascadeType.REMOVE}) + @ElementCollection(fetch = FetchType.EAGER) + @CollectionTable(name="PLMNINFO",joinColumns = @JoinColumn(name="gnbcuupid")) + private List pLMNInfoList; + @Column(name="RESOURCETYPE") + private String resourceType; + @ManyToOne(cascade=CascadeType.ALL) + @JoinColumn(name = "nearrtricid") + private NearRTRIC nearRTRIC; + public Integer getgNBCUUPId() { + return gNBCUUPId; + } + public void setgNBCUUPId(Integer gNBCUUPId) { + this.gNBCUUPId = gNBCUUPId; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + public Integer getgNBIdLength() { + return gNBIdLength; + } + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + public NearRTRIC getNearRTRIC() { + return nearRTRIC; + } + public void setNearRTRIC(NearRTRIC nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + @Override + public String toString() { + return "GNBCUUPFunction [gNBCUUPId=" + gNBCUUPId + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + + ", pLMNInfoList=" + pLMNInfoList + ", resourceType=" + resourceType + ", nearRTRIC=" + nearRTRIC + + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBDUFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBDUFunction.java new file mode 100644 index 0000000..c64472a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBDUFunction.java @@ -0,0 +1,86 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="GNBDUFUNCTION") +public class GNBDUFunction implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="GNBDUID") + private Integer gNBDUId; + @Column(name="GNBID") + private Integer gNBId; + @Column(name="GNBIDLENGTH") + private Integer gNBIdLength; + @Column(name="GNBDUNAME") + private String gNBDUName; + @Column(name="PLMNID") + private String pLMNId; + @Column(name="NFTYPE") + private String nFType; + @Column(name="CELLDULIST") + @OneToMany(mappedBy = "gNBDUFunction",cascade=CascadeType.ALL) + private List cellDUList; + @ManyToOne + @JoinColumn(name = "nearrtricid") + private NearRTRIC nearRTRIC; + public Integer getgNBDUId() { + return gNBDUId; + } + public void setgNBDUId(Integer gNBDUId) { + this.gNBDUId = gNBDUId; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + public Integer getgNBIdLength() { + return gNBIdLength; + } + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + public String getgNBDUName() { + return gNBDUName; + } + public void setgNBDUName(String gNBDUName) { + this.gNBDUName = gNBDUName; + } + public String getpLMNId() { + return pLMNId; + } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + public List getCellDUList() { + return cellDUList; + } + public void setCellDUList(List cellDUList) { + this.cellDUList = cellDUList; + } + public NearRTRIC getNearRTRIC() { + return nearRTRIC; + } + public void setNearRTRIC(NearRTRIC nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + public String getnFType() { + return nFType; + } + public void setnFType(String nFType) { + this.nFType = nFType; + } + +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java index a8104fe..8d49d1a 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java @@ -21,30 +21,29 @@ package org.onap.ransim.rest.api.models; public class GetACellDetailReq { - - private String nodeId; - - /** - * A constructor for GetACellDetailReq. - * - * @param nodeId - * node id of the cell - */ - public GetACellDetailReq(String nodeId) { - super(); - this.nodeId = nodeId; - } - - public GetACellDetailReq() { - - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - + + private String nodeId; + + /** + * A constructor for GetACellDetailReq. + * + * @param nodeId node id of the cell + */ + public GetACellDetailReq(String nodeId) { + super(); + this.nodeId = nodeId; + } + + public GetACellDetailReq() { + + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + } 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 497df10..320db9d 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 @@ -22,55 +22,51 @@ package org.onap.ransim.rest.api.models; import java.util.List; public class GetNeighborList { - - private String nodeId; - private List cellsWithNoHo; - private List cellsWithHo; - - public GetNeighborList() { - super(); - } - - /** - * Constructor with all fields. - * - * @param nodeId - * Node Id of cell - * @param cellsWithNoHO - * List of neighbors with unsuccessful handover. - * @param cellsWithHO - * List of neighbors with successful handover. - */ - public GetNeighborList(String nodeId, List cellsWithNoHo, - List cellsWithHo) { - super(); - this.nodeId = nodeId; - this.cellsWithNoHo = cellsWithNoHo; - this.cellsWithHo = cellsWithHo; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public List getCellsWithNoHo() { - return cellsWithNoHo; - } - - public void setCellsWithNoHo(List cellsWithNoHo) { - this.cellsWithNoHo = cellsWithNoHo; - } - - public List getCellsWithHo() { - return cellsWithHo; - } - - public void setCellsWithHo(List cellsWithHo) { - this.cellsWithHo = cellsWithHo; - } - + + private String nodeId; + private List cellsWithNoHo; + private List cellsWithHo; + + public GetNeighborList() { + super(); + } + + /** + * Constructor with all fields. + * + * @param nodeId Node Id of cell + * @param cellsWithNoHO List of neighbors with unsuccessful handover. + * @param cellsWithHO List of neighbors with successful handover. + */ + public GetNeighborList(String nodeId, List cellsWithNoHo, List cellsWithHo) { + super(); + this.nodeId = nodeId; + this.cellsWithNoHo = cellsWithNoHo; + this.cellsWithHo = cellsWithHo; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public List getCellsWithNoHo() { + return cellsWithNoHo; + } + + public void setCellsWithNoHo(List cellsWithNoHo) { + this.cellsWithNoHo = cellsWithNoHo; + } + + public List getCellsWithHo() { + return cellsWithHo; + } + + public void setCellsWithHo(List cellsWithHo) { + this.cellsWithHo = cellsWithHo; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java index 772211c..3ec491c 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java @@ -21,30 +21,29 @@ package org.onap.ransim.rest.api.models; public class GetNeighborListReq { - - private String nodeId; - - public GetNeighborListReq() { - - } - - /** - * A constructor for GetNeighborListReq. - * - * @param nodeId - * node Id of the cell who's neighbor list is required - */ - public GetNeighborListReq(String nodeId) { - super(); - this.nodeId = nodeId; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - + + private String nodeId; + + public GetNeighborListReq() { + + } + + /** + * A constructor for GetNeighborListReq. + * + * @param nodeId node Id of the cell who's neighbor list is required + */ + public GetNeighborListReq(String nodeId) { + super(); + this.nodeId = nodeId; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java index baddd09..5349190 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java @@ -21,31 +21,30 @@ package org.onap.ransim.rest.api.models; public class GetNetconfServerDetailsReq { - - private String serverId; - - /** - * A constructor for GetNetconfServerDetailsReq. - * - * @param serverId - * server Id of the netconf server - */ - public GetNetconfServerDetailsReq(String serverId) { - super(); - this.serverId = serverId; - } - - public GetNetconfServerDetailsReq() { - - // TODO Auto-generated constructor stub - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - + + private String serverId; + + /** + * A constructor for GetNetconfServerDetailsReq. + * + * @param serverId server Id of the netconf server + */ + public GetNetconfServerDetailsReq(String serverId) { + super(); + this.serverId = serverId; + } + + public GetNetconfServerDetailsReq() { + + // TODO Auto-generated constructor stub + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java index 11ec0ca..245dea3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java @@ -20,42 +20,40 @@ package org.onap.ransim.rest.api.models; public class GetPmDataReq { - - private String nodeIdBad; - private String nodeIdPoor; - - public GetPmDataReq() { - super(); - } - - /** - * Constructor with all fields. - * - * @param nodeIdBad - * Cells with bad PM value. - * @param nodeIdPoor - * Cells with poor PM value. - */ - public GetPmDataReq(String nodeIdBad, String nodeIdPoor) { - super(); - this.nodeIdBad = nodeIdBad; - this.nodeIdPoor = nodeIdPoor; - } - - public String getNodeIdBad() { - return nodeIdBad; - } - - public void setNodeIdBad(String nodeIdBad) { - this.nodeIdBad = nodeIdBad; - } - - public String getNodeIdPoor() { - return nodeIdPoor; - } - - public void setNodeIdPoor(String nodeIdPoor) { - this.nodeIdPoor = nodeIdPoor; - } - + + private String nodeIdBad; + private String nodeIdPoor; + + public GetPmDataReq() { + super(); + } + + /** + * Constructor with all fields. + * + * @param nodeIdBad Cells with bad PM value. + * @param nodeIdPoor Cells with poor PM value. + */ + public GetPmDataReq(String nodeIdBad, String nodeIdPoor) { + super(); + this.nodeIdBad = nodeIdBad; + this.nodeIdPoor = nodeIdPoor; + } + + public String getNodeIdBad() { + return nodeIdBad; + } + + public void setNodeIdBad(String nodeIdBad) { + this.nodeIdBad = nodeIdBad; + } + + public String getNodeIdPoor() { + return nodeIdPoor; + } + + public void setNodeIdPoor(String nodeIdPoor) { + this.nodeIdPoor = nodeIdPoor; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java index 1769a0c..6b2cf32 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java @@ -20,79 +20,73 @@ package org.onap.ransim.rest.api.models; public class GetTopology { - - private CellDetails currentCell; - private int gridX; - private int gridY; - private String nodeId; - private long physicalCellId; - - /** - * A constructor GetTopology. - * - * @param currentCell - * current cell details - * @param gridX - * x coordinate value for the cell - * @param gridY - * y coordinate value for the cell - * @param nodeId - * node id of the cell - * @param physicalCellId - * pci value for the cell - */ - public GetTopology(CellDetails currentCell, int gridX, int gridY, - String nodeId, long physicalCellId) { - super(); - this.currentCell = currentCell; - this.gridX = gridX; - this.gridY = gridY; - this.nodeId = nodeId; - this.physicalCellId = physicalCellId; - } - - public GetTopology() { - - } - - public CellDetails getCurrentCell() { - return currentCell; - } - - public void setCurrentCell(CellDetails currentCell) { - this.currentCell = currentCell; - } - - public int getGridX() { - return gridX; - } - - public void setGridX(int gridX) { - this.gridX = gridX; - } - - public int getGridY() { - return gridY; - } - - public void setGridY(int gridY) { - this.gridY = gridY; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public long getPhysicalCellId() { - return physicalCellId; - } - - public void setPhysicalCellId(long physicalCellId) { - this.physicalCellId = physicalCellId; - } - + + private CellDetails currentCell; + private int gridX; + private int gridY; + private String nodeId; + private long physicalCellId; + + /** + * A constructor GetTopology. + * + * @param currentCell current cell details + * @param gridX x coordinate value for the cell + * @param gridY y coordinate value for the cell + * @param nodeId node id of the cell + * @param physicalCellId pci value for the cell + */ + public GetTopology(CellDetails currentCell, int gridX, int gridY, String nodeId, long physicalCellId) { + super(); + this.currentCell = currentCell; + this.gridX = gridX; + this.gridY = gridY; + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + } + + public GetTopology() { + + } + + public CellDetails getCurrentCell() { + return currentCell; + } + + public void setCurrentCell(CellDetails currentCell) { + this.currentCell = currentCell; + } + + public int getGridX() { + return gridX; + } + + public void setGridX(int gridX) { + this.gridX = gridX; + } + + public int getGridY() { + return gridY; + } + + public void setGridY(int gridY) { + this.gridY = gridY; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public long getPhysicalCellId() { + return physicalCellId; + } + + public void setPhysicalCellId(long physicalCellId) { + this.physicalCellId = physicalCellId; + } + } 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 5e9dbc5..6d20fcf 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 @@ -21,56 +21,53 @@ package org.onap.ransim.rest.api.models; public class ModifyACellReq { - - private String nodeId; - private Long newPhysicalCellId; - private String newNbrs; - - /** - * A constructor for ModifyACellReq. - * - * @param nodeId - * node Id of the cell which is to be modified - * @param newPhysicalCellId - * new PCI number for the cell - * @param newNbrs - * new neighbor list for the cell - */ - public ModifyACellReq(String nodeId, Long newPhysicalCellId, String newNbrs) { - super(); - this.nodeId = nodeId; - this.newPhysicalCellId = newPhysicalCellId; - this.newNbrs = newNbrs; - - } - - public ModifyACellReq() { - - // Default constructor for ModifyCell - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public Long getNewPhysicalCellId() { - return newPhysicalCellId; - } - - public void setNewPhysicalCellId(Long newPhysicalCellId) { - this.newPhysicalCellId = newPhysicalCellId; - } - - public String getNewNbrs() { - return newNbrs; - } - - public void setNewNbrs(String newNbrs) { - this.newNbrs = newNbrs; - } - + + private String nodeId; + private Long newPhysicalCellId; + private String newNbrs; + + /** + * A constructor for ModifyACellReq. + * + * @param nodeId node Id of the cell which is to be modified + * @param newPhysicalCellId new PCI number for the cell + * @param newNbrs new neighbor list for the cell + */ + public ModifyACellReq(String nodeId, Long newPhysicalCellId, String newNbrs) { + super(); + this.nodeId = nodeId; + this.newPhysicalCellId = newPhysicalCellId; + this.newNbrs = newNbrs; + + } + + public ModifyACellReq() { + + // Default constructor for ModifyCell + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public Long getNewPhysicalCellId() { + return newPhysicalCellId; + } + + public void setNewPhysicalCellId(Long newPhysicalCellId) { + this.newPhysicalCellId = newPhysicalCellId; + } + + public String getNewNbrs() { + return newNbrs; + } + + public void setNewNbrs(String newNbrs) { + this.newNbrs = newNbrs; + } + } 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 new file mode 100644 index 0000000..a00f88e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java @@ -0,0 +1,58 @@ +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; + +@Entity +@Table(name="NRCELLCU") +public class NRCellCU implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="CELLLOCALID") + private Integer cellLocalId; + @Column(name="RESOURCETYPE") + private String resourceType; + @ElementCollection(fetch = FetchType.EAGER) + @CollectionTable(name="PLMNINFO",joinColumns = @JoinColumn(name="nrcellcu_celllocalid")) + private List pLMNInfoList; + @ManyToOne + @JoinColumn(name = "gnbcuname") + private GNBCUCPFunction gNBCUCPFunction; + + public Integer getCellLocalId() { + return cellLocalId; + } + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + public GNBCUCPFunction getgNBCUCPFunction() { + return gNBCUCPFunction; + } + public void setgNBCUCPFunction(GNBCUCPFunction gNBCUCPFunction) { + this.gNBCUCPFunction = gNBCUCPFunction; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + +} 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 new file mode 100644 index 0000000..89ac059 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java @@ -0,0 +1,98 @@ +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; + +@Entity +@Table(name="NRCELLDU") +public class NRCellDU implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="CELLLOCALID") + private Integer cellLocalId; + @Column(name="OPERATIONALSTATE") + private String operationalState; + @Column(name="ADMINISTRATIVESTATE") + private String administrativeState; + @Column(name="CELLSTATE") + private String cellState; + @ElementCollection(fetch = FetchType.EAGER) + @CollectionTable(name="PLMNINFO",joinColumns = @JoinColumn(name="nrcelldu_celllocalid")) + private List pLMNInfoList; + @Column(name="NRPCI") + private Integer nRPCI; + @Column(name="nRTAC") + private Integer nRTAC; + @Column(name="RESOURCETYPE") + private String resourceType; + @ManyToOne + @JoinColumn(name = "gnbduid") + private GNBDUFunction gNBDUFunction; + + public Integer getCellLocalId() { + return cellLocalId; + } + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + public String getOperationalState() { + return operationalState; + } + public void setOperationalState(String operationalState) { + this.operationalState = operationalState; + } + public String getAdministrativeState() { + return administrativeState; + } + public void setAdministrativeState(String administrativeState) { + this.administrativeState = administrativeState; + } + public String getCellState() { + return cellState; + } + public void setCellState(String cellState) { + this.cellState = cellState; + } + public Integer getnRPCI() { + return nRPCI; + } + public void setnRPCI(Integer nRPCI) { + this.nRPCI = nRPCI; + } + public Integer getnRTAC() { + return nRTAC; + } + public void setnRTAC(Integer nRTAC) { + this.nRTAC = nRTAC; + } + public GNBDUFunction getgNBDUFunction() { + return gNBDUFunction; + } + public void setgNBDUFunction(GNBDUFunction gNBDUFunction) { + this.gNBDUFunction = gNBDUFunction; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NSSAIConfig.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NSSAIConfig.java new file mode 100644 index 0000000..d7d6b2b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NSSAIConfig.java @@ -0,0 +1,45 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.Table; +import java.sql.Timestamp; + +@Table(name="NSSAICONFIG") +@Embeddable +public class NSSAIConfig implements Serializable{ + private static final long serialVersionUID = 1L; + @Column(name="DLTHPTPERSLICE") + private Integer dLThptPerSlice; + @Column(name="ULTHPTPERSLICE") + private Integer uLThptPerSlice; + @Column(name="MAXNUMBEROFCONNS") + private Integer maxNumberOfConns; + @Column(name="LASTUPDATEDTS") + private Timestamp lastUpdatedTS; + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + public Integer getMaxNumberOfConns() { + return maxNumberOfConns; + } + public void setMaxNumberOfConns(Integer maxNumberOfConns) { + this.maxNumberOfConns = maxNumberOfConns; + } + public Timestamp getLastUpdatedTS() { + return lastUpdatedTS; + } + public void setLastUpdatedTS(Timestamp lastUpdatedTS) { + this.lastUpdatedTS = lastUpdatedTS; + } +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java index 8e2ffb9..1033b3b 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java @@ -20,35 +20,35 @@ package org.onap.ransim.rest.api.models; public class NbrDump { - - private String nodeId; - private String blacklisted; - - public NbrDump() { - super(); - // TODO Auto-generated constructor stub - } - - public NbrDump(String nodeId, String blacklisted) { - super(); - this.nodeId = nodeId; - this.blacklisted = blacklisted; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public String getBlacklisted() { - return blacklisted; - } - - public void setBlacklisted(String blacklisted) { - this.blacklisted = blacklisted; - } - + + private String nodeId; + private String blacklisted; + + public NbrDump() { + super(); + // TODO Auto-generated constructor stub + } + + public NbrDump(String nodeId, String blacklisted) { + super(); + this.nodeId = nodeId; + this.blacklisted = blacklisted; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public String getBlacklisted() { + return blacklisted; + } + + public void setBlacklisted(String blacklisted) { + this.blacklisted = blacklisted; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java new file mode 100644 index 0000000..ff0c516 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java @@ -0,0 +1,96 @@ +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.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; +@Entity +@Table(name="NEARRTRIC") +public class NearRTRIC implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="NEARRTRICID") + private Integer nearRTRICId; + @Column(name="GNBID") + private Integer gNBId; + @ElementCollection(targetClass = String.class) + @CollectionTable(name="TRACKINGAREA", joinColumns = @JoinColumn(name="nearrtricid")) + private List trackingArea; + @Column(name="RESOURCETYPE") + private String resourceType; + @OneToMany(mappedBy = "nearRTRIC", cascade=CascadeType.ALL) + private List gNBCUCPList; + @OneToMany(mappedBy = "nearRTRIC", cascade=CascadeType.ALL) + private List gNBCUUPList; + @OneToMany(mappedBy = "nearRTRIC", cascade=CascadeType.ALL) + private List gNBDUList; + @ElementCollection(targetClass = String.class) + @CollectionTable(name="RANNFNSSI",joinColumns = @JoinColumn(name="nearrtricid")) + private List ranNFNSSIList; + @ElementCollection + @CollectionTable(name="PLMNINFO",joinColumns = @JoinColumn(name="nearrtricid")) + private List pLMNInfoList; + public Integer getNearRTRICId() { + return nearRTRICId; + } + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public List getTrackingArea() { + return trackingArea; + } + public void setTrackingArea(List trackingArea) { + this.trackingArea = trackingArea; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + public List getgNBCUCPList() { + return gNBCUCPList; + } + public void setgNBCUCPList(List gNBCUCPList) { + this.gNBCUCPList = gNBCUCPList; + } + public List getgNBCUUPList() { + return gNBCUUPList; + } + public void setgNBCUUPList(List gNBCUUPList) { + this.gNBCUUPList = gNBCUUPList; + } + public List getgNBDUList() { + return gNBDUList; + } + public void setgNBDUList(List gNBDUList) { + this.gNBDUList = gNBDUList; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + public List getRanNFNSSIList() { + return ranNFNSSIList; + } + public void setRanNFNSSIList(List ranNFNSSIList) { + this.ranNFNSSIList = ranNFNSSIList; + } + +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java index 92a03f1..4af3166 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java @@ -19,47 +19,43 @@ */ package org.onap.ransim.rest.api.models; -import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; -import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "NeighborDetails") public class NeighborDetails { - - @EmbeddedId - private NeihborId neigbor; - - private boolean blacklisted; - - public NeighborDetails() { - - } - public NeighborDetails(NeihborId neigbor, boolean blacklisted) { - super(); - this.neigbor = neigbor; - this.blacklisted = blacklisted; - } + @EmbeddedId + private NeihborId neigbor; + private boolean blacklisted; - public NeihborId getNeigbor() { - return neigbor; - } + public NeighborDetails() { - public void setNeigbor(NeihborId neigbor) { - this.neigbor = neigbor; - } + } - public boolean isBlacklisted() { - return blacklisted; - } + public NeighborDetails(NeihborId neigbor, boolean blacklisted) { + super(); + this.neigbor = neigbor; + this.blacklisted = blacklisted; + } + + public NeihborId getNeigbor() { + return neigbor; + } + + public void setNeigbor(NeihborId neigbor) { + this.neigbor = neigbor; + } + + public boolean isBlacklisted() { + return blacklisted; + } + + public void setBlacklisted(boolean blacklisted) { + this.blacklisted = blacklisted; + } - public void setBlacklisted(boolean blacklisted) { - this.blacklisted = blacklisted; - } - - } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java index a5614f1..a18a55b 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java @@ -20,45 +20,45 @@ package org.onap.ransim.rest.api.models; public class NeighborPmDetails { - - private String nbrCellId; - private String kpiName; - private int kpiValue; - - public NeighborPmDetails(String nbrCellId, String kpiName, int kpiValue) { - super(); - this.nbrCellId = nbrCellId; - this.kpiName = kpiName; - this.kpiValue = kpiValue; - } - - public NeighborPmDetails() { - super(); - // TODO Auto-generated constructor stub - } - - public String getNbrCellId() { - return nbrCellId; - } - - public void setNbrCellId(String nbrCellId) { - this.nbrCellId = nbrCellId; - } - - public String getKpiName() { - return kpiName; - } - - public void setKpiName(String kpiName) { - this.kpiName = kpiName; - } - - public int getKpiValue() { - return kpiValue; - } - - public void setKpiValue(int kpiValue) { - this.kpiValue = kpiValue; - } - + + private String nbrCellId; + private String kpiName; + private int kpiValue; + + public NeighborPmDetails(String nbrCellId, String kpiName, int kpiValue) { + super(); + this.nbrCellId = nbrCellId; + this.kpiName = kpiName; + this.kpiValue = kpiValue; + } + + public NeighborPmDetails() { + super(); + // TODO Auto-generated constructor stub + } + + public String getNbrCellId() { + return nbrCellId; + } + + public void setNbrCellId(String nbrCellId) { + this.nbrCellId = nbrCellId; + } + + public String getKpiName() { + return kpiName; + } + + public void setKpiName(String kpiName) { + this.kpiName = kpiName; + } + + public int getKpiValue() { + return kpiValue; + } + + public void setKpiValue(int kpiValue) { + this.kpiValue = kpiValue; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java index 13bf9b7..3bef66d 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java @@ -23,71 +23,68 @@ import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Embeddable; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; @Embeddable public class NeihborId implements Serializable { - - @Column(name = "sourceCellNodeId") - private String sourceCellNodeId; - - @Column(name = "neighborCellNodeId") - private String neighborCell; - - public NeihborId() { - } - - public NeihborId(String sourceCellNodeId, String neighborCell) { - this.sourceCellNodeId = sourceCellNodeId; - this.neighborCell = neighborCell; - } - - public String getSourceCellNodeId() { - return sourceCellNodeId; - } - - public String getNeighborCell() { - return neighborCell; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((neighborCell == null) ? 0 : neighborCell.hashCode()); - result = prime - * result - + ((sourceCellNodeId == null) ? 0 : sourceCellNodeId.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - NeihborId other = (NeihborId) obj; - if (neighborCell == null) { - if (other.neighborCell != null) { - return false; - } - } else if (!neighborCell.equals(other.neighborCell)) - return false; - if (sourceCellNodeId == null) { - if (other.sourceCellNodeId != null) { - return false; - } - } else if (!sourceCellNodeId.equals(other.sourceCellNodeId)) { - return false; - } - return true; - } + + private static final long serialVersionUID = 1L; + + @Column(name = "sourceCellNodeId") + private String sourceCellNodeId; + + @Column(name = "neighborCellNodeId") + private String neighborCell; + + public NeihborId() { + } + + public NeihborId(String sourceCellNodeId, String neighborCell) { + this.sourceCellNodeId = sourceCellNodeId; + this.neighborCell = neighborCell; + } + + public String getSourceCellNodeId() { + return sourceCellNodeId; + } + + public String getNeighborCell() { + return neighborCell; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((neighborCell == null) ? 0 : neighborCell.hashCode()); + result = prime * result + ((sourceCellNodeId == null) ? 0 : sourceCellNodeId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + NeihborId other = (NeihborId) obj; + if (neighborCell == null) { + if (other.neighborCell != null) { + return false; + } + } else if (!neighborCell.equals(other.neighborCell)) + return false; + if (sourceCellNodeId == null) { + if (other.sourceCellNodeId != null) { + return false; + } + } else if (!sourceCellNodeId.equals(other.sourceCellNodeId)) { + return false; + } + return true; + } } \ No newline at end of file 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 bf91f7b..e0a1dc9 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 @@ -26,79 +26,74 @@ import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; +import javax.persistence.FetchType; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name = "NetconfServers") public class NetconfServers { - - @Id - @Column(name = "serverId", unique = true, nullable = false, length = 20) - private String serverId; - - private String ip; - private String netconfPort; - - @OneToMany(targetEntity = CellDetails.class, orphanRemoval = true, cascade = { CascadeType.ALL }) - // @OneToMany(targetEntity = CellDetails.class) - private Set cells; - - public NetconfServers() { - - } - - /** - * A constructor for Netconf server table class. - * - * @param serverId - * server Id of the netconf server - * @param ip - * ip address of the netconf server - * @param netconfPort - * port number of the netconf server - * @param cells - * List of cells belonging to the netconf server - */ - public NetconfServers(String serverId, String ip, String netconfPort, - Set cells) { - super(); - this.serverId = serverId; - this.ip = ip; - this.netconfPort = netconfPort; - this.cells = cells; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getNetconfPort() { - return netconfPort; - } - - public void setNetconfPort(String netconfPort) { - this.netconfPort = netconfPort; - } - - public Set getCells() { - return cells; - } - - public void setCells(Set cells) { - this.cells = cells; - } - + + @Id + @Column(name = "serverId", unique = true, nullable = false, length = 20) + private String serverId; + + private String ip; + private String netconfPort; + + @OneToMany(targetEntity = CellDetails.class,fetch = FetchType.EAGER, cascade = CascadeType.ALL) + private Set cells; + + public NetconfServers() { + + } + + /** + * A constructor for Netconf server table class. + * + * @param serverId server Id of the netconf server + * @param ip ip address of the netconf server + * @param netconfPort port number of the netconf server + * @param cells List of cells belonging to the netconf server + */ + public NetconfServers(String serverId, String ip, String netconfPort, Set cells) { + super(); + this.serverId = serverId; + this.ip = ip; + this.netconfPort = netconfPort; + this.cells = cells; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getNetconfPort() { + return netconfPort; + } + + public void setNetconfPort(String netconfPort) { + this.netconfPort = netconfPort; + } + + public Set getCells() { + return cells; + } + + public void setCells(Set cells) { + this.cells = cells; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java index cfc55ce..5d6e82e 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java @@ -30,37 +30,32 @@ import javax.persistence.GenerationType; @Entity @Table(name = "OperationLog") public class OperationLog { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private int rowId; - private long time; - private String nodeId; - private String source; - - @Column(name = "message", length = 300) - private String message; - private String fieldName; - private String operation; - /*private String prevValue; - - @Column(name = "currValue", length = 500) - private String currValue;*/ - - public int getRowId() { - return rowId; - } - - public void setRowId(int rowId) { - this.rowId = rowId; - } - - public long getTime() { - return time; - } - - - public String getSource() { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int rowId; + private long time; + private String nodeId; + private String source; + + @Column(name = "message", length = 300) + private String message; + private String fieldName; + private String operation; + + public int getRowId() { + return rowId; + } + + public void setRowId(int rowId) { + this.rowId = rowId; + } + + public long getTime() { + return time; + } + + public String getSource() { return source; } @@ -69,40 +64,39 @@ public class OperationLog { } public void setTime(long time) { - this.time = time; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation; - } - - + this.time = time; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfo.java new file mode 100644 index 0000000..699c7bd --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfo.java @@ -0,0 +1,43 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Embeddable +@Table(name = "PLMNINFO") +public class PLMNInfo implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name = "PLMNID") + private String pLMNId; + + @Embedded + private SNSSAI sNSSAI; + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + + public SNSSAI getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(SNSSAI sNSSAI) { + this.sNSSAI = sNSSAI; + } + +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java new file mode 100644 index 0000000..df7b312 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java @@ -0,0 +1,115 @@ +/* ============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.rest.api.models; + +public class PLMNInfoModel { +private String pLMNId; +private String snssai; +private String status; +private String gnbType; +private int gnbId; +private int nrCellId; +private String nearrtricid; +private long maxNumberOfConns; + +public PLMNInfoModel() { + +} + + +public PLMNInfoModel(String pLMNId, String snssai, String status, String gnbType, int gnbId, int nrCellId, +String nearrtricid, long maxNumberOfConns) { +super(); +this.pLMNId = pLMNId; +this.snssai = snssai; +this.status = status; +this.gnbType = gnbType; +this.gnbId = gnbId; +this.nrCellId = nrCellId; +this.nearrtricid = nearrtricid; +this.maxNumberOfConns = maxNumberOfConns; +} + + +public String getpLMNId() { +return pLMNId; +} + +public void setpLMNId(String pLMNId) { +this.pLMNId = pLMNId; +} + +public String getSnssai() { +return snssai; +} + +public void setSnssai(String snssai) { +this.snssai = snssai; +} + +public String getStatus() { +return status; +} + +public void setStatus(String status) { +this.status = status; +} + +public String getGnbType() { +return gnbType; +} + +public void setGnbType(String gnbType) { +this.gnbType = gnbType; +} + +public int getGnbId() { +return gnbId; +} + +public void setGnbId(int gnbId) { +this.gnbId = gnbId; +} + + +public int getNrCellId() { +return nrCellId; +} + +public void setNrCellId(int nrCellId) { +this.nrCellId = nrCellId; +} +public String getNearrtricid() { +return nearrtricid; +} + +public void setNearrtricid(String nearrtricid) { +this.nearrtricid = nearrtricid; +} + +public long getMaxNumberOfConns() { +return maxNumberOfConns; +} + +public void setMaxNumberOfConns(long maxNumberOfConns) { +this.maxNumberOfConns = maxNumberOfConns; +} +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java index 745b475..9f0ad6e 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java @@ -23,25 +23,25 @@ package org.onap.ransim.rest.api.models; import java.util.List; public class PmDataDump { - - private List kpiDump; - - public PmDataDump() { - super(); - // TODO Auto-generated constructor stub - } - - public PmDataDump(List kpiDump) { - super(); - this.kpiDump = kpiDump; - } - - public List getKpiDump() { - return kpiDump; - } - - public void setKpiDump(List kpiDump) { - this.kpiDump = kpiDump; - } - + + private List kpiDump; + + public PmDataDump() { + super(); + // TODO Auto-generated constructor stub + } + + public PmDataDump(List kpiDump) { + super(); + this.kpiDump = kpiDump; + } + + public List getKpiDump() { + return kpiDump; + } + + public void setKpiDump(List kpiDump) { + this.kpiDump = kpiDump; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java index fc48e02..6ff4721 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java @@ -21,65 +21,78 @@ package org.onap.ransim.rest.api.models; public class PmParameters { - - private String parameter1; - private String successValue1; - private String badValue1; - private String poorValue1; - private String parameter2; - private String successValue2; - private String badValue2; - private String poorValue2; - - public String getParameter1() { - return parameter1; - } - public void setParameter1(String parameter1) { - this.parameter1 = parameter1; - } - public String getSuccessValue1() { - return successValue1; - } - public void setSuccessValue1(String successValue1) { - this.successValue1 = successValue1; - } - public String getBadValue1() { - return badValue1; - } - public void setBadValue1(String badValue1) { - this.badValue1 = badValue1; - } - public String getPoorValue1() { - return poorValue1; - } - public void setPoorValue1(String poorValue1) { - this.poorValue1 = poorValue1; - } - public String getParameter2() { - return parameter2; - } - public void setParameter2(String parameter2) { - this.parameter2 = parameter2; - } - public String getSuccessValue2() { - return successValue2; - } - public void setSuccessValue2(String successValue2) { - this.successValue2 = successValue2; - } - public String getBadValue2() { - return badValue2; - } - public void setBadValue2(String badValue2) { - this.badValue2 = badValue2; - } - public String getPoorValue2() { - return poorValue2; - } - public void setPoorValue2(String poorValue2) { - this.poorValue2 = poorValue2; - } - - - + + private String parameter1; + private String successValue1; + private String badValue1; + private String poorValue1; + private String parameter2; + private String successValue2; + private String badValue2; + private String poorValue2; + + public String getParameter1() { + return parameter1; + } + + public void setParameter1(String parameter1) { + this.parameter1 = parameter1; + } + + public String getSuccessValue1() { + return successValue1; + } + + public void setSuccessValue1(String successValue1) { + this.successValue1 = successValue1; + } + + public String getBadValue1() { + return badValue1; + } + + public void setBadValue1(String badValue1) { + this.badValue1 = badValue1; + } + + public String getPoorValue1() { + return poorValue1; + } + + public void setPoorValue1(String poorValue1) { + this.poorValue1 = poorValue1; + } + + public String getParameter2() { + return parameter2; + } + + public void setParameter2(String parameter2) { + this.parameter2 = parameter2; + } + + public String getSuccessValue2() { + return successValue2; + } + + public void setSuccessValue2(String successValue2) { + this.successValue2 = successValue2; + } + + public String getBadValue2() { + return badValue2; + } + + public void setBadValue2(String badValue2) { + this.badValue2 = badValue2; + } + + public String getPoorValue2() { + return poorValue2; + } + + public void setPoorValue2(String poorValue2) { + this.poorValue2 = poorValue2; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RANSliceInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RANSliceInfo.java new file mode 100644 index 0000000..47eb7a1 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RANSliceInfo.java @@ -0,0 +1,101 @@ +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.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity(name="RANINVENTORY") +@Table(name="RANINVENTORY") +public class RANSliceInfo implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="RANNFNSSIID") + private String ranNFNSSIId; + @ElementCollection + @CollectionTable(name="rannssi", joinColumns = @JoinColumn(name="rannfnssiid")) + private List ranNSSIList; + @ElementCollection + @CollectionTable(name="nssai", joinColumns = @JoinColumn(name="rannfnssiid")) + private List nSSAIList; + @OneToMany(mappedBy = "rANSliceInventory", cascade=CascadeType.ALL) + private List sliceProfilesList; + @Column(name="TALIST") + private String trackingAreaList; + @Column(name="SUBNETSTATUS") + private String subnetStatus; + @Column(name="NSSTID") + private String nsstId; + @Column(name="SLICETYPE") + private String sliceType; + @Column(name="ISSHAREABLE") + private String isShareable; + public String getRanNFNSSIId() { + return ranNFNSSIId; + } + public void setRanNFNSSIId(String ranNFNSSIId) { + this.ranNFNSSIId = ranNFNSSIId; + } + public List getRanNSSIList() { + return ranNSSIList; + } + public void setRanNSSIList(List ranNSSIList) { + this.ranNSSIList = ranNSSIList; + } + public List getSliceProfilesList() { + return sliceProfilesList; + } + public void setSliceProfilesList(List sliceProfilesList) { + this.sliceProfilesList = sliceProfilesList; + } + public String getSubnetStatus() { + return subnetStatus; + } + public void setSubnetStatus(String subnetStatus) { + this.subnetStatus = subnetStatus; + } + public String getNsstId() { + return nsstId; + } + public void setNsstId(String nsstId) { + this.nsstId = nsstId; + } + public String getSliceType() { + return sliceType; + } + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + public String getIsShareable() { + return isShareable; + } + public void setIsShareable(String isShareable) { + this.isShareable = isShareable; + } + public List getnSSAIList() { + return nSSAIList; + } + public void setnSSAIList(List nSSAIList) { + this.nSSAIList = nSSAIList; + } + public String getTrackingAreaList() { + return trackingAreaList; + } + public void setTrackingAreaList(String trackingAreaList) { + this.trackingAreaList = trackingAreaList; + } + @Override + public String toString() { + return "RANSliceInfo [ranNFNSSIId=" + ranNFNSSIId + ", ranNSSIList=" + ranNSSIList + ", nSSAIList=" + nSSAIList + + ", sliceProfilesList=" + sliceProfilesList + ", trackingAreaList=" + trackingAreaList + + ", subnetStatus=" + subnetStatus + ", nsstId=" + nsstId + ", sliceType=" + sliceType + + ", isShareable=" + isShareable + "]"; + } +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyMember.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyMember.java new file mode 100644 index 0000000..1b204b3 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyMember.java @@ -0,0 +1,41 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="RRMPOLICYMEMBER") +public class RRMPolicyMember implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name = "PLMNID") + private String pLMNId; + @Column(name="SNSSAI") + private String sNSSAI; + @ManyToOne + private RRMPolicyRatio rrmPolicy; + + public String getpLMNId() { + return pLMNId; + } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public String getsNSSAI() { + return sNSSAI; + } + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + public RRMPolicyRatio getRrmPolicy() { + return rrmPolicy; + } + public void setRrmPolicy(RRMPolicyRatio rrmPolicy) { + this.rrmPolicy = rrmPolicy; + } +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java new file mode 100644 index 0000000..a662eb2 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java @@ -0,0 +1,91 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="RRMPOLICYRATIO") +public class RRMPolicyRatio implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="RRMPOLICYID") + private Integer rrmPolicyID; + @Column(name="RESOURCEID") + private String resourceID; + @Column(name="RESOURCETYPE") + private String resourceType; + @Column(name="SLICETYPE") + private String sliceType; +// @OneToMany(mappedBy = "rrmPolicy", cascade={CascadeType.PERSIST,CascadeType.REMOVE}) + @OneToMany(mappedBy = "rrmPolicy", cascade = CascadeType.ALL) + private List rRMPolicyMemberList; + @Column(name="QUOTATYPE") + private String quotaType; + @Column(name="RRMPOLICYMAXRATIO") + private Integer rRMPolicyMaxRatio; + @Column(name="RRMPOLICYMINRATIO") + private Integer rRMPolicyMinRatio; + @Column(name="RRMPOLICYDEDICATEDRATIO") + private Integer rRMPolicyDedicatedRatio; + public Integer getRrmPolicyID() { + return rrmPolicyID; + } + public void setRrmPolicyID(Integer rrmPolicyID) { + this.rrmPolicyID = rrmPolicyID; + } + public String getResourceID() { + return resourceID; + } + public void setResourceID(String resourceID) { + this.resourceID = resourceID; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + public String getSliceType() { + return sliceType; + } + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + public List getrRMPolicyMemberList() { + return rRMPolicyMemberList; + } + public void setrRMPolicyMemberList(List rRMPolicyMemberList) { + this.rRMPolicyMemberList = rRMPolicyMemberList; + } + public String getQuotaType() { + return quotaType; + } + public void setQuotaType(String quotaType) { + this.quotaType = quotaType; + } + public Integer getrRMPolicyMaxRatio() { + return rRMPolicyMaxRatio; + } + public void setrRMPolicyMaxRatio(Integer rRMPolicyMaxRatio) { + this.rRMPolicyMaxRatio = rRMPolicyMaxRatio; + } + public Integer getrRMPolicyMinRatio() { + return rRMPolicyMinRatio; + } + public void setrRMPolicyMinRatio(Integer rRMPolicyMinRatio) { + this.rRMPolicyMinRatio = rRMPolicyMinRatio; + } + public Integer getrRMPolicyDedicatedRatio() { + return rRMPolicyDedicatedRatio; + } + public void setrRMPolicyDedicatedRatio(Integer rRMPolicyDedicatedRatio) { + this.rRMPolicyDedicatedRatio = rRMPolicyDedicatedRatio; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SNSSAI.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SNSSAI.java new file mode 100644 index 0000000..db43ce0 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SNSSAI.java @@ -0,0 +1,68 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.Embedded; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Embeddable +@Table(name = "SNSSAI") +public class SNSSAI implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name = "sNSSAI") + private String sNSSAI; + @Column(name = "STATUS") + private String status; + @Column(name = "GLOBALSUBSCRIBERID") + private String globalSubscriberId; + @Column(name = "SUBSCRIPTIONSERVICETYPE") + private String subscriptionServiceType; + @Embedded + private NSSAIConfig configData; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public NSSAIConfig getConfigData() { + return configData; + } + + public void setConfigData(NSSAIConfig configData) { + this.configData = configData; + } + + public String getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java index 2d51c83..1738e65 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java @@ -22,29 +22,28 @@ package org.onap.ransim.rest.api.models; public class SetCollisionReq { - private boolean collision; - - /** - * A constructor for SetCollisionReq. - * - * @param collision - * to set if the new simulation has collision between the cells - */ - public SetCollisionReq(boolean collision) { - super(); - this.collision = collision; - } - - public SetCollisionReq() { - - } - - public boolean isCollision() { - return collision; - } - - public void setCollision(boolean collision) { - this.collision = collision; - } + private boolean collision; + + /** + * A constructor for SetCollisionReq. + * + * @param collision to set if the new simulation has collision between the cells + */ + public SetCollisionReq(boolean collision) { + super(); + this.collision = collision; + } + + public SetCollisionReq() { + + } + + public boolean isCollision() { + return collision; + } + + public void setCollision(boolean collision) { + this.collision = collision; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java index 1d6d9d5..bd99dee 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java @@ -22,91 +22,87 @@ package org.onap.ransim.rest.api.models; public class SetConstants { - private int gridSize; - private int gridType; - private boolean collision; - - private int processCapacity; - private int numberOfMachines; - private String serverIdPrefix; - - public SetConstants() { - - } - - /** - * A constructor for SetConstants. - * - * @param gridSize - * grid dimension for the topology (number of cells along the side) - * @param gridType - * honeycomb or square grid - * @param collision - * to set if the new simulation has collision between the cells - * @param processCapacity - * number of netconf servers - * @param numberOfMachines - * number of machines running in one netconf server - * @param serverIdPrefix - * server id prefix - */ - public SetConstants(int gridSize, int gridType, boolean collision, int processCapacity, int numberOfMachines, - String serverIdPrefix) { - super(); - this.gridSize = gridSize; - this.gridType = gridType; - this.collision = collision; - this.processCapacity = processCapacity; - this.numberOfMachines = numberOfMachines; - this.serverIdPrefix = serverIdPrefix; - } - - public int getGridSize() { - return gridSize; - } - - public void setGridSize(int gridSize) { - this.gridSize = gridSize; - } - - public int getGridType() { - return gridType; - } - - public void setGridType(int gridType) { - this.gridType = gridType; - } - - public boolean isCollision() { - return collision; - } - - public void setCollision(boolean collision) { - this.collision = collision; - } - - public int getProcessCapacity() { - return processCapacity; - } - - public void setProcessCapacity(int processCapacity) { - this.processCapacity = processCapacity; - } - - public int getNumberOfMachines() { - return numberOfMachines; - } - - public void setNumberOfMachines(int numberOfMachines) { - this.numberOfMachines = numberOfMachines; - } - - public String getServerIdPrefix() { - return serverIdPrefix; - } - - public void setServerIdPrefix(String serverIdPrefix) { - this.serverIdPrefix = serverIdPrefix; - } + private int gridSize; + private int gridType; + private boolean collision; + + private int processCapacity; + private int numberOfMachines; + private String serverIdPrefix; + + public SetConstants() { + + } + + /** + * A constructor for SetConstants. + * + * @param gridSize grid dimension for the topology (number of cells + * along the side) + * @param gridType honeycomb or square grid + * @param collision to set if the new simulation has collision between + * the cells + * @param processCapacity number of netconf servers + * @param numberOfMachines number of machines running in one netconf server + * @param serverIdPrefix server id prefix + */ + public SetConstants(int gridSize, int gridType, boolean collision, int processCapacity, int numberOfMachines, + String serverIdPrefix) { + super(); + this.gridSize = gridSize; + this.gridType = gridType; + this.collision = collision; + this.processCapacity = processCapacity; + this.numberOfMachines = numberOfMachines; + this.serverIdPrefix = serverIdPrefix; + } + + public int getGridSize() { + return gridSize; + } + + public void setGridSize(int gridSize) { + this.gridSize = gridSize; + } + + public int getGridType() { + return gridType; + } + + public void setGridType(int gridType) { + this.gridType = gridType; + } + + public boolean isCollision() { + return collision; + } + + public void setCollision(boolean collision) { + this.collision = collision; + } + + public int getProcessCapacity() { + return processCapacity; + } + + public void setProcessCapacity(int processCapacity) { + this.processCapacity = processCapacity; + } + + public int getNumberOfMachines() { + return numberOfMachines; + } + + public void setNumberOfMachines(int numberOfMachines) { + this.numberOfMachines = numberOfMachines; + } + + public String getServerIdPrefix() { + return serverIdPrefix; + } + + public void setServerIdPrefix(String serverIdPrefix) { + this.serverIdPrefix = serverIdPrefix; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SliceProfile.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SliceProfile.java new file mode 100644 index 0000000..4705674 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SliceProfile.java @@ -0,0 +1,130 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="SLICEPROFILE") +public class SliceProfile implements Serializable{ + private static final long serialVersionUID = 1L; + + @Id + @Column(name="SLICEPROFILEID") + private String sliceProfileId; + @Column(name="SNSSAI") + private String sNSSAI; + @Column(name="PLMNIDLIST") + private String pLMNIdList; + @Column(name="MAXNOOFUES") + private Integer maxNumberofUEs; + @Column(name="LATENCY") + private Integer latency; + @Column(name="DLTHPTPERSLICE") + private Integer dLThptPerSlice; + @Column(name="ULTHPTPERSLICE") + private Integer uLThptPerSlice; + @Column(name="MAXNUMBEROFCONNS") + private Integer maxNumberofConns; + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + public Integer getMaxNumberofConns() { + return maxNumberofConns; + } + public void setMaxNumberofConns(Integer maxNumberofConns) { + this.maxNumberofConns = maxNumberofConns; + } + public String getCoverageAreaList() { + return coverageAreaList; + } + + /* + * @Column(name="EXPDATARATEDL") private Integer expDataRateDL; + * + * @Column(name="EXPDATARATEUL") private Integer expDataRateUL; + * + * @Column(name="MAXNUMBEROFPDUSESSIONS") private Integer + * maxNumberofPDUSessions; + */ + @Column(name="UEMOBILITYLEVEL") + private String uEMobilityLevel; + @Column(name="RESOURCESHARINGLEVEL") + private String resourceSharingLevel; + //@ElementCollection + //@CollectionTable(name="coveragearealist", joinColumns = @JoinColumn(name="sliceprofileid")) + @Column(name="coveragearealist") + private String coverageAreaList; + @ManyToOne + @JoinColumn(name = "rannfnssiid") + private RANSliceInfo rANSliceInventory; + public String getSliceProfileId() { + return sliceProfileId; + } + public void setSliceProfileId(String sliceProfileId) { + this.sliceProfileId = sliceProfileId; + } + public String getsNSSAI() { + return sNSSAI; + } + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + public String getpLMNIdList() { + return pLMNIdList; + } + public void setpLMNIdList(String pLMNIdList) { + this.pLMNIdList = pLMNIdList; + } + public Integer getMaxNumberofUEs() { + return maxNumberofUEs; + } + public void setMaxNumberofUEs(Integer maxNumberofUEs) { + this.maxNumberofUEs = maxNumberofUEs; + } + public Integer getLatency() { + return latency; + } + public void setLatency(Integer latency) { + this.latency = latency; + } + public String getuEMobilityLevel() { + return uEMobilityLevel; + } + public void setuEMobilityLevel(String uEMobilityLevel) { + this.uEMobilityLevel = uEMobilityLevel; + } + public String getResourceSharingLevel() { + return resourceSharingLevel; + } + public void setResourceSharingLevel(String resourceSharingLevel) { + this.resourceSharingLevel = resourceSharingLevel; + } + public RANSliceInfo getrANSliceInventory() { + return rANSliceInventory; + } + public void setrANSliceInventory(RANSliceInfo rANSliceInventory) { + this.rANSliceInventory = rANSliceInventory; + } + + public void setCoverageAreaList(String coverageAreaList) { + this.coverageAreaList = coverageAreaList; + } + +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TACells.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TACells.java new file mode 100644 index 0000000..b56cf2b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TACells.java @@ -0,0 +1,36 @@ +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="TACELLS") +public class TACells implements Serializable{ + private static final long serialVersionUID = 1L; + @Id + @Column(name="TRACKINGAREA") + private String trackingArea; + @Column(name="CELLS") + private String cellsList; + public String getTrackingArea() { + return trackingArea; + } + public void setTrackingArea(String trackingArea) { + this.trackingArea = trackingArea; + } + + public String getCellsList() { + return cellsList; + } + public void setCellsList(String cellsList) { + this.cellsList = cellsList; + } + @Override + public String toString() { + return "TACells [trackingArea=" + trackingArea + ", cellsList=" + cellsList + "]"; + } +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java index 87d575e..faf7c54 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java @@ -23,90 +23,84 @@ package org.onap.ransim.rest.api.models; import java.util.List; public class Topology { - int gridSize; - float minScreenX = 0; - float minScreenY = 0; - float maxScreenX = 10; - float maxScreenY = 10; - List cellTopology; - - /** - * A constructor for Topology. - * - * @param gridSize - * grid size - * @param minScreenX - * min value of screen X for a cell in the topology - * @param minScreenY - * min value of screen Y for a cell in the topology - * @param maxScreenX - * max value of screen X for a cell in the topology - * @param maxScreenY - * max value of screen Y for a cell in the topology - * @param cellTopology - * list of cells within the topology - */ - public Topology(int gridSize, float minScreenX, float minScreenY, float maxScreenX, float maxScreenY, - List cellTopology) { - super(); - this.gridSize = gridSize; - this.minScreenX = minScreenX; - this.minScreenY = minScreenY; - this.maxScreenX = maxScreenX; - this.maxScreenY = maxScreenY; - this.cellTopology = cellTopology; - } - - public Topology() { - - } - - public int getGridSize() { - return gridSize; - } - - public void setGridSize(int gridSize) { - this.gridSize = gridSize; - } - - public float getMinScreenX() { - return minScreenX; - } - - public void setMinScreenX(float minScreenX) { - this.minScreenX = minScreenX; - } - - public float getMinScreenY() { - return minScreenY; - } - - public void setMinScreenY(float minScreenY) { - this.minScreenY = minScreenY; - } - - public float getMaxScreenX() { - return maxScreenX; - } - - public void setMaxScreenX(float maxScreenX) { - this.maxScreenX = maxScreenX; - } - - public float getMaxScreenY() { - return maxScreenY; - } - - public void setMaxScreenY(float maxScreenY) { - this.maxScreenY = maxScreenY; - } - - public List getCellTopology() { - return cellTopology; - } - - public void setCellTopology(List cellTopology) { - this.cellTopology = cellTopology; - } + int gridSize; + float minScreenX = 0; + float minScreenY = 0; + float maxScreenX = 10; + float maxScreenY = 10; + List cellTopology; + + /** + * A constructor for Topology. + * + * @param gridSize grid size + * @param minScreenX min value of screen X for a cell in the topology + * @param minScreenY min value of screen Y for a cell in the topology + * @param maxScreenX max value of screen X for a cell in the topology + * @param maxScreenY max value of screen Y for a cell in the topology + * @param cellTopology list of cells within the topology + */ + public Topology(int gridSize, float minScreenX, float minScreenY, float maxScreenX, float maxScreenY, + List cellTopology) { + super(); + this.gridSize = gridSize; + this.minScreenX = minScreenX; + this.minScreenY = minScreenY; + this.maxScreenX = maxScreenX; + this.maxScreenY = maxScreenY; + this.cellTopology = cellTopology; + } + + public Topology() { + + } + + public int getGridSize() { + return gridSize; + } + + public void setGridSize(int gridSize) { + this.gridSize = gridSize; + } + + public float getMinScreenX() { + return minScreenX; + } + + public void setMinScreenX(float minScreenX) { + this.minScreenX = minScreenX; + } + + public float getMinScreenY() { + return minScreenY; + } + + public void setMinScreenY(float minScreenY) { + this.minScreenY = minScreenY; + } + + public float getMaxScreenX() { + return maxScreenX; + } + + public void setMaxScreenX(float maxScreenX) { + this.maxScreenX = maxScreenX; + } + + public float getMaxScreenY() { + return maxScreenY; + } + + public void setMaxScreenY(float maxScreenY) { + this.maxScreenY = maxScreenY; + } + + public List getCellTopology() { + return cellTopology; + } + + public void setCellTopology(List cellTopology) { + this.cellTopology = cellTopology; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java index d7825f9..b2aefec 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java @@ -24,29 +24,28 @@ import java.util.List; public class TopologyDump { - private List cellList; + private List cellList; - /** - * A constructor for TopologyDump. - * - * @param cellList - * list of cells - */ - public TopologyDump(List cellList) { + /** + * A constructor for TopologyDump. + * + * @param cellList list of cells + */ + public TopologyDump(List cellList) { - this.cellList = cellList; - } + this.cellList = cellList; + } - public TopologyDump() { + public TopologyDump() { - } + } - public List getCellList() { - return cellList; - } + public List getCellList() { + return cellList; + } - public void setCellList(List cellList) { - this.cellList = cellList; - } + public void setCellList(List cellList) { + this.cellList = cellList; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellDetailsRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellDetailsRepo.java new file mode 100644 index 0000000..48e20bf --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellDetailsRepo.java @@ -0,0 +1,37 @@ +/*- + * ============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.rest.api.repository; + +import java.util.List; + +import org.onap.ransim.rest.api.models.CellDetails; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CellDetailsRepo extends CrudRepository { + + @Query("SELECT n FROM CellDetails n WHERE n.serverId is null") + List findCellsWithNoServerId(); + + @Query("SELECT cd from CellDetails cd where cd.pciCollisionDetected=true or cd.pciConfusionDetected=true") + List getCellsWithCollisionOrConfusion(); +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellNeighborRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellNeighborRepo.java new file mode 100644 index 0000000..99b620a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellNeighborRepo.java @@ -0,0 +1,29 @@ +/*- + * ============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.rest.api.repository; + +import org.onap.ransim.rest.api.models.CellNeighbor; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CellNeighborRepo extends CrudRepository { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUCPRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUCPRepository.java new file mode 100644 index 0000000..b591e09 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUCPRepository.java @@ -0,0 +1,17 @@ +package org.onap.ransim.rest.api.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import org.onap.ransim.rest.api.models.GNBCUCPFunction; + +@Repository +public interface GNBCUCPRepository extends CrudRepository{ + @Query(nativeQuery=true, value="select distinct(cucp.gnbcuname) from gnbcucpfunction cucp join nrcellcu cellcu where cellcu.celllocalid in (:cellIdList)") + public List findCUCPByCellIds(List cellIdList); + @Query(nativeQuery = true, value = "select * from gnbcucpfunction cucp join plmninfo plmn where plmn.snssai=?1 and plmn.nrcellcu_celllocalid IS NOT NULL") + public List findCUCPsByNSSAI(String nSSAI); +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java new file mode 100644 index 0000000..8d15deb --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java @@ -0,0 +1,10 @@ +package org.onap.ransim.rest.api.repository; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.onap.ransim.rest.api.models.GNBCUUPFunction; + +@Repository +public interface GNBCUUPRepository extends CrudRepository{ + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBDURepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBDURepository.java new file mode 100644 index 0000000..cbc2182 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBDURepository.java @@ -0,0 +1,14 @@ +package org.onap.ransim.rest.api.repository; + +import java.util.List; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.onap.ransim.rest.api.models.GNBDUFunction; + +@Repository +public interface GNBDURepository extends CrudRepository{ + @Query(nativeQuery = true, value = "select * from gnbdufunction du join plmninfo plmn where plmn.snssai=?1 and plmn.nrcelldu_celllocalid IS NOT NULL") + public List findDUsByNSSAI(String nSSAI); +} + 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 new file mode 100644 index 0000000..4890343 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java @@ -0,0 +1,10 @@ +package org.onap.ransim.rest.api.repository; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.onap.ransim.rest.api.models.NRCellCU; + +@Repository +public interface NRCellCURepository extends CrudRepository{ + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellDURepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellDURepository.java new file mode 100644 index 0000000..b1c123c --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellDURepository.java @@ -0,0 +1,8 @@ +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.NRCellDU; +import org.springframework.data.repository.CrudRepository; + +public interface NRCellDURepository extends CrudRepository { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NearRTRICRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NearRTRICRepository.java new file mode 100644 index 0000000..2f90fd4 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NearRTRICRepository.java @@ -0,0 +1,24 @@ +package org.onap.ransim.rest.api.repository; + +import java.util.List; +import java.util.Set; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.onap.ransim.rest.api.models.NearRTRIC; + +@Repository +public interface NearRTRICRepository extends CrudRepository{ + + @Query(nativeQuery = true, value = "select * from nearrtric ric join trackingarea ta where tracking_area=?1") + public List getListOfRICsInTrackingArea(String trackingArea); + + @Query(nativeQuery=true, value="select * from nearrtric ric join gnbcucpfunction cucp where cucp.gnbcuname=?1") + public List findNearRTRICByCUCPName(String cucpNames); + + @Query(nativeQuery = true, value = "select * from nearrtric ric join rannfnssi nssi where nssi.rannfnssilist=?1") + public List findNearRTRICByNSSI(String ranNFNSSIId); + + @Query(nativeQuery = true, value = "select * from nearrtric ric join plmninfo plmn where plmn.snssai=?1 and plmn.nearrtricid IS NOT NULL") + public Set findNearRTRICByNSSAI(String nSSAI); +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NeighborDetailsRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NeighborDetailsRepo.java new file mode 100644 index 0000000..7209f40 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NeighborDetailsRepo.java @@ -0,0 +1,29 @@ +/*- + * ============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.rest.api.repository; + +import org.onap.ransim.rest.api.models.NeighborDetails; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface NeighborDetailsRepo extends CrudRepository { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NetconfServersRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NetconfServersRepo.java new file mode 100644 index 0000000..e0ecc03 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NetconfServersRepo.java @@ -0,0 +1,29 @@ +/*- + * ============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.rest.api.repository; + +import org.onap.ransim.rest.api.models.NetconfServers; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface NetconfServersRepo extends CrudRepository { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/OperationLogRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/OperationLogRepo.java new file mode 100644 index 0000000..0541fec --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/OperationLogRepo.java @@ -0,0 +1,29 @@ +/*- + * ============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.rest.api.repository; + +import org.onap.ransim.rest.api.models.OperationLog; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface OperationLogRepo extends CrudRepository{ + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RANInventoryRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RANInventoryRepository.java new file mode 100644 index 0000000..7511a89 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RANInventoryRepository.java @@ -0,0 +1,13 @@ +package org.onap.ransim.rest.api.repository; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import org.onap.ransim.rest.api.models.RANSliceInfo; + +@Repository +public interface RANInventoryRepository extends CrudRepository{ + @Query(nativeQuery = true, value = "select distinct(raninfo.rannfnssiid) from raninventory raninfo join nssai where nssai.nssailist=?1") + public String findRANNFNSSIofNSSAI(String sNSSAI); +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyMemberRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyMemberRepository.java new file mode 100644 index 0000000..a6f96d8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyMemberRepository.java @@ -0,0 +1,31 @@ +/******************************************************************************* +* ============LICENSE_START======================================================= +* Config DB +* ================================================================================ +* Copyright (C) 2020-2021 Wipro Limited. +* ============================================================================== +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* 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.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import org.onap.ransim.rest.api.models.RRMPolicyMember; + +@Repository +public interface RRMPolicyMemberRepository extends CrudRepository{ + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyRepository.java new file mode 100644 index 0000000..7a37572 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyRepository.java @@ -0,0 +1,15 @@ +package org.onap.ransim.rest.api.repository; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import org.onap.ransim.rest.api.models.RRMPolicyRatio; + +@Repository +public interface RRMPolicyRepository extends CrudRepository{ + + @Query(nativeQuery = true, value="select * from rrmpolicy where resourcetype=?1 and resourceid=?2") + public RRMPolicyRatio findByResourceTypeAndId(String resourceType, String resourceId); + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/SliceProfileRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/SliceProfileRepository.java new file mode 100644 index 0000000..717160a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/SliceProfileRepository.java @@ -0,0 +1,9 @@ +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.SliceProfile; +import org.springframework.data.repository.CrudRepository; + +public interface SliceProfileRepository extends CrudRepository { + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/TACellRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/TACellRepository.java new file mode 100644 index 0000000..6ad6971 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/TACellRepository.java @@ -0,0 +1,15 @@ +package org.onap.ransim.rest.api.repository; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import org.onap.ransim.rest.api.models.TACells; +/*** + * + * @author onapadmin + * + */ +@Repository +public interface TACellRepository extends CrudRepository { + +} 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 new file mode 100644 index 0000000..8ecd1f5 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java @@ -0,0 +1,614 @@ +package org.onap.ransim.rest.api.services; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.onap.ransim.rest.api.models.GNBCUCPFunction; +import org.onap.ransim.rest.api.models.GNBCUUPFunction; +import org.onap.ransim.rest.api.models.GNBDUFunction; +import org.onap.ransim.rest.api.models.NRCellCU; +import org.onap.ransim.rest.api.models.NRCellDU; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.api.models.NearRTRIC; +import org.onap.ransim.rest.api.models.PLMNInfo; +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.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.NearRTRICRepository; +import org.onap.ransim.rest.api.repository.RANInventoryRepository; +import org.onap.ransim.rest.api.repository.RRMPolicyRepository; +import org.onap.ransim.rest.api.repository.TACellRepository; +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.NRCellDUModel; +import org.onap.ransim.rest.web.mapper.NearRTRICModel; +import org.onap.ransim.rest.web.mapper.RANSliceInfoModel; +import org.onap.ransim.rest.web.mapper.RRMPolicyRatioModel; + +@Service +public class RANSliceConfigService { + private static final Logger logger = LoggerFactory.getLogger(RANSliceConfigService.class); + @Autowired + private NRCellCURepository nRCellCURepository; + + @Autowired + private GNBCUCPRepository gNBCUCPRepository; + + @Autowired + private GNBCUUPRepository gNBCUUPRepository; + + @Autowired + private GNBDURepository gNBDURepository; + + @Autowired + private NearRTRICRepository nearRTRICRepository; + + @Autowired + private RRMPolicyRepository rRMPolicyRepository; + + @Autowired + private RANInventoryRepository ranInventoryRepo; + + @Autowired + private TACellRepository tACellRepository; + + private ModelMapper modelMapper = new ModelMapper(); + + /** + * To store/update the NRCEllCU details + * + * @param nRCellCUModel + * @return NRCellCUModel + */ + public NRCellCUModel saveNRcellCU(NRCellCUModel nRCellCUModel) { + logger.debug("Request received to save NRcellCU: id::"+ nRCellCUModel.getCellLocalId()); + NRCellCU cellCUEntity = new NRCellCU(); + modelMapper.map(nRCellCUModel, cellCUEntity); + if(!cellCUEntity.getpLMNInfoList().isEmpty()) { + for(PLMNInfo plmn:cellCUEntity.getpLMNInfoList()) { + //plmn.setnRCellCU(cellCUEntity); + } + } + NRCellCU cellCUEntityResponse = nRCellCURepository.save(cellCUEntity); + modelMapper.map(cellCUEntityResponse,nRCellCUModel); + return nRCellCUModel; + } + + /** + * To fetch the NRCellCU details + * + * @param cellLocalId + * @return NRCellCUModel + */ + public NRCellCUModel fetchNRCellCUDetails(Integer cellLocalId) { + logger.debug("Request received to fetchNRCellCUDetails: id::"+ cellLocalId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + NRCellCU cellCUEntity = nRCellCURepository.findById(cellLocalId).isPresent()?nRCellCURepository.findById(cellLocalId).get():null; + NRCellCUModel nRCellCUModel = new NRCellCUModel(); + modelMapper.map(cellCUEntity,nRCellCUModel); + return nRCellCUModel; + } + + /** + * To store the slice / config details of GNBCUCPFunction + * @param gNBCUCPModel + * @return + */ + public GNBCUCPModel saveGNBCUCP(GNBCUCPModel gNBCUCPModel) { + logger.debug("Request received to save GNBCUCPModel: id::"+ gNBCUCPModel.getgNBCUName()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUCPFunction gNBCUCPFunction=new GNBCUCPFunction(); NearRTRIC nearRTRICRef = new NearRTRIC(); + try { + modelMapper.map(gNBCUCPModel, gNBCUCPFunction); + if(gNBCUCPModel.getNearRTRICId()!=null && nearRTRICRepository.findById(gNBCUCPModel.getNearRTRICId()).isPresent()) { + gNBCUCPFunction.setNearRTRIC(nearRTRICRepository.findById(gNBCUCPModel.getNearRTRICId()).get()); + } + if(gNBCUCPFunction!=null && !gNBCUCPFunction.getCellCUList().isEmpty()) { + gNBCUCPFunction.getCellCUList().forEach(cellCU->{ + cellCU.setgNBCUCPFunction(gNBCUCPFunction); + }); + } + GNBCUCPFunction gNBCUCPEntity = gNBCUCPRepository.save(gNBCUCPFunction); + modelMapper.map(gNBCUCPEntity,gNBCUCPModel); + }catch(Exception e) { + logger.debug("Error occured during saveGNBCUCP"+e.getMessage()); + return null; + } + return gNBCUCPModel; + } + + /** + * To fetch the gNBCUCP details + * + * @param cucpName + * @return GNBCUCPModel + */ + public GNBCUCPModel fetchGNBCUCPData(String cucpName) { + logger.debug("Request received to fetch GNBCUCPFunction: name::"+ cucpName); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUCPFunction gNBCUCPEntity = gNBCUCPRepository.findById(cucpName).isPresent()?gNBCUCPRepository.findById(cucpName).get():null; + GNBCUCPModel gNBCUCPModel = new GNBCUCPModel(); + modelMapper.map(gNBCUCPEntity,gNBCUCPModel); + return gNBCUCPModel; + } + + /** + * To store the slice / config details of GNBCUCPFunction + * @param gNBCUCPModel + * @return + */ + public GNBCUUPModel saveGNBCUUP(GNBCUUPModel gNBCUUPModel) { + logger.debug("Request received to save GNBCUUPModel: id::"+ gNBCUUPModel.getgNBCUUPId()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUUPFunction gNBCUUPFunction=new GNBCUUPFunction(); + modelMapper.map(gNBCUUPModel, gNBCUUPFunction); + if(gNBCUUPModel.getNearRTRICId()!=null && nearRTRICRepository.findById(gNBCUUPModel.getNearRTRICId()).isPresent()) { + gNBCUUPFunction.setNearRTRIC(nearRTRICRepository.findById(gNBCUUPModel.getNearRTRICId()).get()); + } + if(gNBCUUPFunction!=null && !gNBCUUPFunction.getpLMNInfoList().isEmpty()) { + gNBCUUPFunction.getpLMNInfoList().forEach(plmn->{ + //plmn.setgNBCUUPFunction(gNBCUUPFunction); + }); + } + GNBCUUPFunction gNBCUUPEntity = gNBCUUPRepository.save(gNBCUUPFunction); + modelMapper.map(gNBCUUPEntity,gNBCUUPModel); + return gNBCUUPModel; + } + + /** + * To fetch the gNBCUUP details + * + * @param cucpName + * @return GNBCUUPModel + */ + public GNBCUUPModel fetchGNBCUUPData(Integer gNBCUUPId) { + logger.debug("Request received to fetch GNBCUUPFunction: id::"+ gNBCUUPId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUUPFunction gNBCUUPEntity = gNBCUUPRepository.findById(gNBCUUPId).isPresent()?gNBCUUPRepository.findById(gNBCUUPId).get():null; + GNBCUUPModel gNBCUUPModel = new GNBCUUPModel(); + modelMapper.map(gNBCUUPEntity,gNBCUUPModel); + return gNBCUUPModel; + } + + /** + * To store the slice / config details of GNBDUFunction + * @param GNBDUModel + * @return + */ + public GNBDUModel saveGNBDU(GNBDUModel gNBDUModel) { + logger.debug("Request received to save GNBDUModel: id::"+ gNBDUModel.getgNBDUId()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBDUFunction gNBDUFunction=new GNBDUFunction();NearRTRIC nearRTRICRef = new NearRTRIC(); + modelMapper.map(gNBDUModel, gNBDUFunction); + if(gNBDUModel.getNearRTRICId()!=null && nearRTRICRepository.findById(gNBDUModel.getNearRTRICId()).isPresent()) { + nearRTRICRef = nearRTRICRepository.findById(gNBDUModel.getNearRTRICId()).get(); + gNBDUFunction.setNearRTRIC(nearRTRICRef); + } + NearRTRIC nearRTRICRefNew = nearRTRICRef; + nearRTRICRefNew.setNearRTRICId(gNBDUModel.getNearRTRICId()); + if(gNBDUFunction!=null && !gNBDUFunction.getCellDUList().isEmpty()) { + gNBDUFunction.getCellDUList().forEach(cellDU->{ + cellDU.setgNBDUFunction(gNBDUFunction); + }); + } + GNBDUFunction gNBDUEntity = gNBDURepository.save(gNBDUFunction); + modelMapper.map(gNBDUEntity,gNBDUModel); + return gNBDUModel; + } + + /** + * To fetch the gNBDU details + * + * @param gNBDUId + * @return GNBDUModel + */ + public GNBDUModel fetchGNBDUData(Integer gNBDUId) { + logger.debug("Request received to fetch GNBDUFunction: id::"+ gNBDUId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBDUFunction gNBDUEntity = gNBDURepository.findById(gNBDUId).isPresent()?gNBDURepository.findById(gNBDUId).get():null; + GNBDUModel gNBDUModel = new GNBDUModel(); + modelMapper.map(gNBDUEntity,gNBDUModel); + return gNBDUModel; + } + + /** + * Stored NearRTRIC + * + * @param nearRTRIC + * @return + */ + public NearRTRICModel saveNearRTRIC(NearRTRICModel nearRTRIC) { + logger.debug("Request received to store NearRTRIC: id::"+ nearRTRIC.getNearRTRICId()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + NearRTRIC nearRTRICEntity = new NearRTRIC(); + modelMapper.map(nearRTRIC, nearRTRICEntity); + NearRTRIC nearRTRICEntityEResponse = nearRTRICRepository.save(nearRTRICEntity); + modelMapper.map(nearRTRICEntityEResponse,nearRTRIC); + return nearRTRIC; + } + + /** + * To fetch the nearRTRIC details + * + * @param nearRTRICId + * @return NearRTRICModel + */ + public NearRTRICModel fetchNearRTRICData(Integer nearRTRICId) { + logger.debug("Request received to fetch GNBDUFunction: id::"+ nearRTRICId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + NearRTRIC nearRTRICEntity = nearRTRICRepository.findById(nearRTRICId).isPresent()?nearRTRICRepository.findById(nearRTRICId).get():null; + NearRTRICModel nearRTRICModel = new NearRTRICModel(); + modelMapper.map(nearRTRICEntity,nearRTRICModel); + return nearRTRICModel; + } + + /** + * To retrieve the RRMPolicy of a network function + * + * @param resourceType + * @param resourceID + * @return + */ + public RRMPolicyRatioModel fetchRRMPolicyOfNE(String resourceType, String resourceID) { + logger.debug("Request received to fetch RRMPolicy:"+ resourceType+"--"+resourceID); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + RRMPolicyRatioModel rrmPolicyResponse = new RRMPolicyRatioModel(); + RRMPolicyRatio rrmPolicyEntity = rRMPolicyRepository.findByResourceTypeAndId(resourceType, resourceID); + modelMapper.map(rrmPolicyEntity, rrmPolicyResponse); + return rrmPolicyResponse; + } + + /** + * To update RRM policy of NF + * + * @param rrmPolicy + * @return + */ + public RRMPolicyRatioModel updateRRMPolicy(RRMPolicyRatioModel rrmPolicy) { + logger.debug("Request received to update RRMPolicy:"+ rrmPolicy.getRrmPolicyID()); + RRMPolicyRatio rrmPolicyEntity = new RRMPolicyRatio(); + modelMapper.map(rrmPolicy, rrmPolicyEntity); + rrmPolicyEntity = rRMPolicyRepository.save(rrmPolicyEntity); + modelMapper.map(rrmPolicyEntity, rrmPolicy); + return rrmPolicy; + } + + /** + * @param trackingArea + * @return List + */ + public List findRICsInTA(String trackingArea) { + logger.debug("Request received to find the NearRTRICs in Tracking Area::"+ trackingArea); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List nearRTRICsList = nearRTRICRepository.getListOfRICsInTrackingArea(trackingArea); + List ricModelList = nearRTRICsList.stream() + .map(ricEntity -> modelMapper.map(ricEntity, NearRTRICModel.class)).collect(Collectors.toList()); + return ricModelList; + } + + /** + * @param cellsList + * @return + */ + public List findNearRTRICofCells(List cellsList){ + List ricEntitiesList = new ArrayList<>(); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List cucpNames = gNBCUCPRepository.findCUCPByCellIds(cellsList); + cucpNames.forEach(cucpName -> { + List ricEntities = new ArrayList<>(); + ricEntities = nearRTRICRepository.findNearRTRICByCUCPName(cucpName); + ricEntitiesList.addAll(ricEntities); + }); + List ricModelList = ricEntitiesList.stream() + .map(ricEntity -> modelMapper.map(ricEntity, NearRTRICModel.class)).collect(Collectors.toList()); + return ricModelList; + } + + + /** + * To update the RAN Slice details + * + * @param rANSliceInfoModel + * @return RANSliceInfoModel + */ + public RANSliceInfoModel updateRANInventory(RANSliceInfoModel rANSliceInfoModel) { + logger.debug("Request received to update inventory for id::"+ rANSliceInfoModel.getRanNFNSSIId()); + RANSliceInfo rANSliceInfoEntity = new RANSliceInfo(); + modelMapper.map(rANSliceInfoModel, rANSliceInfoEntity); + if(ranInventoryRepo.findById(rANSliceInfoModel.getRanNFNSSIId()).isPresent()) { + RANSliceInfo ranInfo = ranInventoryRepo.findById(rANSliceInfoModel.getRanNFNSSIId()).get(); + List ranNSSIList = ranInfo.getRanNSSIList(); + ranNSSIList.addAll(rANSliceInfoEntity.getRanNSSIList()); + rANSliceInfoEntity.setRanNSSIList(ranNSSIList); + + List nSSAIList = ranInfo.getnSSAIList(); + nSSAIList.addAll(rANSliceInfoEntity.getnSSAIList()); + rANSliceInfoEntity.setnSSAIList(nSSAIList); + + List sliceProfilesList = ranInfo.getSliceProfilesList(); + sliceProfilesList.addAll(rANSliceInfoEntity.getSliceProfilesList()); + rANSliceInfoEntity.setSliceProfilesList(sliceProfilesList); + } + else { + if(!rANSliceInfoEntity.getSliceProfilesList().isEmpty()) { + for(SliceProfile profile:rANSliceInfoEntity.getSliceProfilesList()) { + profile.setrANSliceInventory(rANSliceInfoEntity); + } + } + } + rANSliceInfoEntity = ranInventoryRepo.save(rANSliceInfoEntity); + modelMapper.map(rANSliceInfoEntity, rANSliceInfoModel); + return rANSliceInfoModel; + } + + /** + * @param ranNFNSSIId + * @return RANSliceInfoModel + */ + public RANSliceInfoModel fetchRANSlice(String ranNFNSSIId) { + logger.debug("Request received to read inventory details for id::"+ ranNFNSSIId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + RANSliceInfo ranSliceInfo = ranInventoryRepo.findById(ranNFNSSIId).isPresent()?ranInventoryRepo.findById(ranNFNSSIId).get():null; + RANSliceInfoModel rANSliceInfoModel = new RANSliceInfoModel(); + modelMapper.map(ranSliceInfo, rANSliceInfoModel); + return rANSliceInfoModel; + } + + /** + * @param trackingArea + * @return List + */ + public List fetchCellsofTA(String trackingArea) { + logger.debug("Request recieved to fetch the cell details of TA:"+ trackingArea); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + String cells = tACellRepository.findById(trackingArea).isPresent()?tACellRepository.findById(trackingArea).get().getCellsList():null; + return cells!=null? Arrays.asList(cells.split(",")):null; + + } + + public Iterable fetchAllTA() + { + logger.info("Request recieved to fetch all TA:"); + return tACellRepository.findAll(); + } + + /** + * @param nearRTRICId + * @return List + */ + public List fetchCUCellsofRIC(Integer nearRTRICId) { + logger.debug("Request recieved to fetch the cell (CU) details of nearRTRICId:"+ nearRTRICId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List cellCUEntities = new ArrayList(); + NearRTRIC nearRTRIC = nearRTRICRepository.findById(nearRTRICId).isPresent()?nearRTRICRepository.findById(nearRTRICId).get():null; + if(nearRTRIC!=null) { + List cucpFunctions = nearRTRIC.getgNBCUCPList(); + cucpFunctions.forEach(cucpFunction->{ + List cellCUList = new ArrayList(); + cellCUList.addAll(cucpFunction.getCellCUList()); + cellCUEntities.addAll(cellCUList); + }); + List cuCellModels = cellCUEntities.stream() + .map(cellCUEntity -> modelMapper.map(cellCUEntity, NRCellCUModel.class)).collect(Collectors.toList()); + return cuCellModels; + } + return new ArrayList(); + } + + /** + * @param trackingArea + * @return List + */ + public Map> fetchDUCellsofRIC(String sNSSAI) { + logger.debug("Request recieved to fetch the cell (DU) details of sNSSAI:"+ sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Set cellDUEntities = new HashSet();Set cellDUs = new HashSet(); + List ricModels = findRICsByNSSAI(sNSSAI); + Map> cellsMap = new HashMap>(); + List ricEntities = ricModels.stream() + .map(ric -> modelMapper.map(ric, NearRTRIC.class)).collect(Collectors.toList()); + ricEntities.forEach(ricEntity -> { + List duFunctions = ricEntity.getgNBDUList(); + duFunctions.forEach(duFunction -> { + List cellDUList =duFunction.getCellDUList(); + cellDUList.forEach(cellDU->{ + List plmnList = cellDU.getpLMNInfoList(); + plmnList.forEach(plmn->{ + if(sNSSAI.equalsIgnoreCase(plmn.getsNSSAI().getsNSSAI())){ + cellDUs.add(cellDU); + } + }); + }); + //cellDUList.addAll(duFunction.getCellDUList()); + cellDUEntities.addAll(cellDUs); + }); + List duCellModels = cellDUEntities.stream() + .map(cellDUEntity -> modelMapper.map(cellDUEntity, NRCellDUModel.class)).collect(Collectors.toList()); + cellsMap.put(ricEntity.getNearRTRICId(), duCellModels); + }); + + return cellsMap; + } + + /** + * @param ranNFNSSIID + * @return List + */ + public List findNearRTRICByNSSI(String ranNFNSSIID) { + logger.debug("Request recieved to fetch nearRTRIC of NSSI:"+ ranNFNSSIID); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List nearRTRICEntities = nearRTRICRepository.findNearRTRICByNSSI(ranNFNSSIID); + List nearRTRICModels = nearRTRICEntities.stream() + .map(nearRTRICEntity -> modelMapper.map(nearRTRICEntity, NearRTRICModel.class)).collect(Collectors.toList()); + return nearRTRICModels; + } + + /** + * @param sNSSAI + * @return List + */ + public List findRICsByNSSAI(String sNSSAI){ + logger.debug("Request recieved to fetch nearRTRIC of NSSAI:"+ sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Set nearRTRICEntities = nearRTRICRepository.findNearRTRICByNSSAI(sNSSAI); + List nearRTRICModels = nearRTRICEntities.stream() + .map(nearRTRICEntity -> modelMapper.map(nearRTRICEntity, NearRTRICModel.class)) + .collect(Collectors.toList()); + return nearRTRICModels; + } + + /** + * @param sNSSAI + * @return config Details + */ + public Map findSliceProfileconfig(String sNSSAI){ + logger.debug("Request recieved to fetch Config requested for a slice:"+ sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Map configDetails = new HashMap(); + String ranNFNSSIId = ranInventoryRepo.findRANNFNSSIofNSSAI(sNSSAI); + RANSliceInfo rANSliceInfo = ranInventoryRepo.findById(ranNFNSSIId).isPresent()? ranInventoryRepo.findById(ranNFNSSIId).get():null; + if(rANSliceInfo.getSliceProfilesList().size()>0) { + rANSliceInfo.getSliceProfilesList().forEach(sliceProfile->{ + if(sNSSAI.equalsIgnoreCase(sliceProfile.getsNSSAI())){ + //configDetails.put("maxNoOfConns",sliceProfile.getMaxNumberofConns()); + configDetails.put("dLThptPerSlice",sliceProfile.getdLThptPerSlice()); + configDetails.put("uLThptPerSlice",sliceProfile.getuLThptPerSlice()); + } + }); + } + return configDetails; + } + + /** + * @param sNSSAI + * @return RIC Config for a slice + */ + public Map findSliceConfig(String sNSSAI){ + logger.debug("Request recieved to fetch Slice config Details at RICs:"+ sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List nearRTRICModels = findRICsByNSSAI(sNSSAI); + Map configMap = new HashMap(); + nearRTRICModels.forEach(nearRTRIC->{ + nearRTRIC.getpLMNInfoList().forEach(plmn->{ + if(sNSSAI.equalsIgnoreCase(plmn.getsNSSAI().getsNSSAI())) { + configMap.put(nearRTRIC.getNearRTRICId(),plmn.getsNSSAI().getConfigData()); + } + }); + }); + return configMap; + } + + /** + * @param sNSSAI + * @return List + */ + public List findDUsofSNssai(String sNSSAI){ + logger.debug("Request recieved to fetch all DUs of NSSAI"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List duList = (List) gNBDURepository.findDUsByNSSAI(sNSSAI); + List duModels = duList.stream() + .map(duEntity -> modelMapper.map(duEntity, GNBDUModel.class)).collect(Collectors.toList()); + return duModels; + } + + /** + * @param sNSSAI + * @return List + */ + public List findCUsofSNssai(String sNSSAI){ + logger.debug("Request recieved to fetch all CUs of NSSAI"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List cuList = (List) gNBCUCPRepository.findCUCPsByNSSAI(sNSSAI); + List cuModels = cuList.stream() + .map(cuEntity -> modelMapper.map(cuEntity, GNBCUCPModel.class)).collect(Collectors.toList()); + return cuModels; + } + + /** + * @param sNSSAI + * @return Map + */ + public Map getSubscriberDetails(String sNSSAI){ + logger.debug("Request recieved to fetch SubscriberDetails"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Map details = new HashMap(); + String ranNFNSSIId = ranInventoryRepo.findRANNFNSSIofNSSAI(sNSSAI); + details.put("ranNFNSSIId", ranNFNSSIId); + details.put("sNSSAI", sNSSAI); + RANSliceInfo rANSliceInfo = ranInventoryRepo.findById(ranNFNSSIId).isPresent()? ranInventoryRepo.findById(ranNFNSSIId).get():null; + if(rANSliceInfo.getSliceProfilesList().size()>0) { + rANSliceInfo.getSliceProfilesList().forEach(sliceProfile->{ + if(sNSSAI.equalsIgnoreCase(sliceProfile.getsNSSAI())){ + details.put("sliceProfileId",sliceProfile.getSliceProfileId()); + } + }); + } + List nearRTRICModels = findRICsByNSSAI(sNSSAI); + nearRTRICModels.forEach(nearRTRIC->{ + nearRTRIC.getpLMNInfoList().forEach(plmn->{ + if(sNSSAI.equalsIgnoreCase(plmn.getsNSSAI().getsNSSAI())) { + details.put("subscriptionServiceType",plmn.getsNSSAI().getSubscriptionServiceType()); + details.put("globalSubscriberId",plmn.getsNSSAI().getGlobalSubscriberId()); + } + }); + }); + + return details; + } + + // Data required for PM data Simulation + /** + * @return List + */ + public List findAllCUCPFunctions(){ + logger.debug("Request recieved to fetch all CUCPs"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List cucpsList = (List) gNBCUCPRepository.findAll(); + List cucpModels = cucpsList.stream() + .map(cucpEntity -> modelMapper.map(cucpEntity, GNBCUCPModel.class)).collect(Collectors.toList()); + return cucpModels; + } + + /** + * @return List + */ + public List findAllDUFunctions(){ + logger.debug("Request recieved to fetch all DUs"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List duList = (List) gNBDURepository.findAll(); + List duModels = duList.stream() + .map(duEntity -> modelMapper.map(duEntity, GNBDUModel.class)).collect(Collectors.toList()); + return duModels; + } + + public List findAllNearRTRIC() + { + logger.debug("Request received to fetch all NearRTRICModel"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List rtricList = (List) nearRTRICRepository.findAll(); + List rtricmodels = rtricList.stream() + .map(rtricEntity -> modelMapper.map(rtricEntity, NearRTRICModel.class)).collect(Collectors.toList()); + return rtricmodels; + } + +} \ No newline at end of file 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 new file mode 100644 index 0000000..a06f3c7 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java @@ -0,0 +1,1527 @@ +/*- + * ============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.rest.api.services; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Properties; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import javax.annotation.PostConstruct; +import javax.websocket.Session; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.handler.RansimPciHandler; +import org.onap.ransim.rest.api.models.CellData; +import org.onap.ransim.rest.api.models.CellDetails; +import org.onap.ransim.rest.api.models.CellNeighbor; +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.PLMNInfo; +import org.onap.ransim.rest.api.models.TopologyDump; +import org.onap.ransim.rest.api.models.RRMPolicyRatio; +import org.onap.ransim.rest.api.models.RRMPolicyMember; +import org.onap.ransim.rest.api.models.SliceProfile; +import org.onap.ransim.rest.api.repository.GNBCUUPRepository; +import org.onap.ransim.rest.api.repository.NRCellCURepository; +import org.onap.ransim.rest.api.repository.NRCellDURepository; +//import org.onap.ransim.rest.api.repository.PLMNInfoRepo; +import org.onap.ransim.rest.api.repository.RRMPolicyRepository; +import org.onap.ransim.rest.api.repository.SliceProfileRepository; +import org.onap.ransim.rest.client.RestClient; +import org.onap.ransim.utilities.RansimUtilities; +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.SetConfigTopology; +import org.onap.ransim.websocket.model.Topology; +import org.onap.ransim.websocket.model.UpdateCell; +import org.onap.ransim.websocket.model.ConfigPLMNInfo; +import org.onap.ransim.websocket.model.SNSSAI; +import org.onap.ransim.websocket.model.ConfigData; +import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.onap.ransim.rest.web.mapper.NearRTRICModel; +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.NRCellDUModel; +import org.onap.ransim.rest.web.mapper.NRCellCUModel; +import org.onap.ransim.rest.web.mapper.PLMNInfoModel; +import org.onap.ransim.rest.web.mapper.RRMPolicyRatioModel; +import org.onap.ransim.rest.web.mapper.NSSAIData; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; +import com.google.gson.Gson; +import org.onap.ransim.websocket.model.*; +import org.onap.ransim.netconf.NetconfClient; + + +@Service +public class RansimControllerServices { + + static Logger log = Logger.getLogger(RansimControllerServices.class.getName()); + + Properties netconfConstants = new Properties(); + public int gridSize = 10; + boolean collision = false; + String serverIdPrefix = ""; + public static String useCaseType = ""; + static int numberOfCellsPerNcServer = 15; + int numberOfMachines = 1; + int numberOfProcessPerMc = 5; + boolean strictValidateRansimAgentsAvailability = false; + static public Map webSocketSessions = new ConcurrentHashMap(); + public static Map serverIdIpPortMapping = new ConcurrentHashMap(); + + static Map globalNcServerUuidMap = new ConcurrentHashMap(); + static List unassignedServerIds = Collections.synchronizedList(new ArrayList()); + static Map> serverIdIpNodeMapping = new ConcurrentHashMap>(); + static Map> ricIdFunctionMapping = new ConcurrentHashMap>(); + static List unassignedgNBIds = Collections.synchronizedList(new ArrayList()); + static List unassignedrtRicIds = Collections.synchronizedList(new ArrayList()); + static List rtricModelList = Collections.synchronizedList(new ArrayList<>()); + int nextServerIdNumber = 1001; + String sdnrServerIp = ""; + int sdnrServerPort = 0; + static String sdnrServerUserid = ""; + static String sdnrServerPassword = ""; + private static final String fileBasePath = "/tmp/ransim-install/config/"; + public static String dumpFileName = ""; + public static long maxPciValueAllowed = 503; + + @Autowired + RansimPciHandler rsPciHdlr; + + @Autowired + RansimRepositoryService ransimRepo; + + @Autowired + RANSliceConfigService ranSliceConfigService; + + @Autowired + RRMPolicyRepository rrmPolicyRepository; + + @Autowired + NRCellDURepository nRCellDURepository; + + @Autowired + NRCellCURepository nRCellCURepository; + + @Autowired + GNBCUUPRepository gNBCUUPRepository; +/* + @Autowired + PLMNInfoRepo pLMNInfoRepo; + + */ @Autowired + SliceProfileRepository sliceProfileRepository; + + @PostConstruct + private void startWSTheread() { + new KeepWebsockAliveThread(this).start(); + } + + private String checkIpPortAlreadyExists(String ipPort, Map serverIdIpPortMapping) { + String serverId = null; + for (String key : serverIdIpPortMapping.keySet()) { + String value = serverIdIpPortMapping.get(key); + if (value.equals(ipPort)) { + serverId = key; + break; + } + } + return serverId; + } + + /** + * Add web socket sessions. + * * @param ipPort ip address for the session + * @param wsSession session details + */ + public synchronized String addWebSocketSessions(String ipPort, Session wsSession) { + loadProperties(); + if (webSocketSessions.containsKey(ipPort)) { + log.info("addWebSocketSessions: Client session " + wsSession.getId() + " for " + ipPort + + " already exist. Removing old session."); + webSocketSessions.remove(ipPort); + } + + log.info("addWebSocketSessions: Adding Client session " + wsSession.getId() + " for " + ipPort); + webSocketSessions.put(ipPort, wsSession); + String serverId = null; + if (!serverIdIpPortMapping.containsValue(ipPort)) { + if (unassignedServerIds.size() > 0) { + log.info("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + serverId = checkIpPortAlreadyExists(ipPort, serverIdIpPortMapping); + if (serverId == null) { + serverId = unassignedServerIds.remove(0); + } else { + if (unassignedServerIds.contains(serverId)) { + unassignedServerIds.remove(serverId); + } + } + log.info("RanSim Controller - Available unassigned ServerIds :" + unassignedServerIds); + log.info("RanSim Controller - addWebSocketSessions: Adding serverId " + serverId + " for " + ipPort); + serverIdIpPortMapping.put(serverId, ipPort); + log.debug("RanSim Controller - serverIdIpPortMapping >>>> :" + serverIdIpPortMapping); + mapServerIdToNodes(serverId); + try { + + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server != null) { + server.setIp(ipPort.split(":")[0]); + server.setNetconfPort(ipPort.split(":")[1]); + ransimRepo.mergeNetconfServers(server); + } + + } catch (Exception e1) { + log.error("Exception mapServerIdToNodes :", e1); + } + } else { + log.error("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + } + } else { + for (String key : serverIdIpPortMapping.keySet()) { + if (serverIdIpPortMapping.get(key).equals(ipPort)) { + log.info("addWebSocketSessions: ServerId " + key + " for " + ipPort + " is exist already"); + serverId = key; + break; + } + } + } + return serverId; + } + + public synchronized String addRanWebSocketSessions(String ipPort, Session wsSession) { + if (webSocketSessions.containsKey(ipPort)) { + log.info("addWebSocketSessions: Client session " + wsSession.getId() + " for " + ipPort + + " already exist. Removing old session."); + webSocketSessions.remove(ipPort); + } + + log.info("addWebSocketSessions: Adding Client session " + wsSession.getId() + " for " + ipPort); + webSocketSessions.put(ipPort, wsSession); + String serverId = null; + if (!serverIdIpPortMapping.containsValue(ipPort)) { + if(!ricIdFunctionMapping.isEmpty()){ + if (unassignedgNBIds.size() > 0) { + log.info("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + serverId = checkIpPortAlreadyExists(ipPort, serverIdIpPortMapping); + if (serverId == null) { + serverId = unassignedgNBIds.remove(0); + } else { + if (unassignedgNBIds.contains(serverId)) { + unassignedgNBIds.remove(serverId); + } + } + log.info("RanSim Controller - Available unassigned ServerIds :" + unassignedgNBIds); + log.info("RanSim Controller - addWebSocketSessions: Adding serverId " + serverId + " for " + ipPort); + serverIdIpPortMapping.put(serverId, ipPort); + log.debug("RanSim Controller - serverIdIpPortMapping >>>> :" + serverIdIpPortMapping); + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server != null) { + server.setIp(ipPort.split(":")[0]); + server.setNetconfPort(ipPort.split(":")[1]); + ransimRepo.mergeNetconfServers(server); + } + + } catch (Exception e1) { + log.error("Exception mapServerIdToNodes :", e1); + } + } else + { + if(unassignedrtRicIds.size() > 0) + { + unassignedgNBIds.addAll(ricIdFunctionMapping.get(unassignedrtRicIds.get(0))); + log.info("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + serverId = checkIpPortAlreadyExists(ipPort, serverIdIpPortMapping); + if (serverId == null) { + serverId = unassignedrtRicIds.remove(0); + } else { + if (unassignedrtRicIds.contains(serverId)) { + unassignedrtRicIds.remove(serverId); + } + } + log.info("RanSim Controller - Available unassigned ServerIds :" + unassignedrtRicIds); + log.info("RanSim Controller - addWebSocketSessions: Adding serverId " + serverId + " for " + ipPort); + serverIdIpPortMapping.put(serverId, ipPort); + log.debug("RanSim Controller - serverIdIpPortMapping >>>> :" + serverIdIpPortMapping); + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server != null) { + server.setIp(ipPort.split(":")[0]); + server.setNetconfPort(ipPort.split(":")[1]); + ransimRepo.mergeNetconfServers(server); + } + + } catch (Exception e1) { + log.error("Exception mapServerIdToNodes :", e1); + } + } + else + { + log.info("addWebSocketSessions: No ric serverIds pending to assign for " + ipPort); + } + } + } + else + { + log.error("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + } + } else { + for (String key : serverIdIpPortMapping.keySet()) { + if (serverIdIpPortMapping.get(key).equals(ipPort)) { + log.info("addWebSocketSessions: ServerId " + key + " for " + ipPort + " is exist already"); + serverId = key; + break; + } + } + } + return serverId; + } + + /** + * Map server ID to the cells + * + * @param serverId Server ID + */ + private void mapServerIdToNodes(String serverId) { + dumpSessionDetails(); + // already mapped.RansimController Do nothing. + if (!serverIdIpNodeMapping.containsKey(serverId)) { + List nodeIds = new ArrayList(); + try { + List nodes = ransimRepo.getCellsWithNoServerIds(); + for (CellDetails cell : nodes) { + cell.setServerId(serverId); + nodeIds.add(cell.getNodeId()); + ransimRepo.mergeCellDetails(cell); + } + serverIdIpNodeMapping.put(serverId, nodeIds); + } catch (Exception e1) { + log.info("Exception mapServerIdToNodes :", e1); + + } + } + } + + /** + * It removes the web socket sessions. + * + * @param ipPort ip address of the netconf server + */ + public synchronized void removeWebSocketSessions(String ipPort) { + log.info("remove websocket session request received for: " + ipPort); + try { + if (webSocketSessions.containsKey(ipPort)) { + String removedServerId = null; + for (String serverId : serverIdIpPortMapping.keySet()) { + String ipPortVal = serverIdIpPortMapping.get(serverId); + if (ipPortVal.equals(ipPort)) { + if (!unassignedServerIds.contains(serverId)) { + unassignedServerIds.add(serverId); + log.info(serverId + "added in unassignedServerIds"); + } + NetconfServers ns = ransimRepo.getNetconfServer(serverId); + ns.setIp(null); + ns.setNetconfPort(null); + log.info(serverId + " ip and Port set as null "); + ransimRepo.mergeNetconfServers(ns); + removedServerId = serverId; + break; + } + } + serverIdIpPortMapping.remove(removedServerId); + + Session wsSession = webSocketSessions.remove(ipPort); + log.info("removeWebSocketSessions: Client session " + wsSession.getId() + " for " + ipPort + + " is removed. Server Id : " + removedServerId); + } else { + log.info("addWebSocketSessions: Client session for " + ipPort + " not exist"); + } + } catch (Exception e) { + log.error("Exception in removeWebSocketSessions. e: " + e); + } + + } + + /** + * Checks the number of ransim agents running. + * + * @param cellsToBeSimulated number of cells to be simulated + * @return returns true if there are enough ransim agents running + */ + public boolean hasEnoughRansimAgentsRunning(int cellsToBeSimulated) { + + log.info("hasEnoughRansimAgentsRunning: numberOfCellsPerNCServer " + numberOfCellsPerNcServer + + " , webSocketSessions.size:" + webSocketSessions.size() + " , cellsToBeSimulated:" + + cellsToBeSimulated); + log.info(strictValidateRansimAgentsAvailability); + + if (strictValidateRansimAgentsAvailability) { + if (numberOfCellsPerNcServer * webSocketSessions.size() < cellsToBeSimulated) { + return false; + } + } + return true; + } + + /** + * It updates the constant values in the properties file. + */ + public void loadProperties() { + InputStream input = null; + try { + + input = new FileInputStream("/tmp/ransim-install/config/ransim.properties"); + netconfConstants.load(input); + serverIdPrefix = netconfConstants.getProperty("serverIdPrefix"); + numberOfCellsPerNcServer = Integer.parseInt(netconfConstants.getProperty("numberOfCellsPerNCServer")); + numberOfMachines = Integer.parseInt(netconfConstants.getProperty("numberOfMachines")); + numberOfProcessPerMc = Integer.parseInt(netconfConstants.getProperty("numberOfProcessPerMc")); + strictValidateRansimAgentsAvailability = Boolean + .parseBoolean(netconfConstants.getProperty("strictValidateRansimAgentsAvailability")); + maxPciValueAllowed = Long.parseLong(netconfConstants.getProperty("maxPciValueAllowed")); + sdnrServerIp = System.getenv("SDNR_IP"); + sdnrServerPort = Integer.parseInt(System.getenv("SDNR_PORT")); + sdnrServerUserid = System.getenv("SDNR_USER"); + sdnrServerPassword = System.getenv("SDNR_PASSWORD"); + useCaseType = "sonUsecase"; + + } catch (Exception e) { + log.error("Properties file error", e); + } finally { + try { + if (input != null) { + input.close(); + } + } catch (Exception ex) { + log.error("Properties file error", ex); + } + } + } + + public void loadGNBFunctionProperties() { + try + { + sdnrServerIp = System.getenv("SDNR_IP"); + sdnrServerPort = Integer.parseInt(System.getenv("SDNR_PORT")); + sdnrServerUserid = System.getenv("SDNR_USER"); + sdnrServerPassword = System.getenv("SDNR_PASSWORD"); + useCaseType = "ranSlicingUsecase"; + rtricModelList = ranSliceConfigService.findAllNearRTRIC(); + for(NearRTRICModel rtricModel:rtricModelList) + { + List gNBList = new ArrayList<>(); + for(GNBCUCPModel gNBCUCPModel : rtricModel.getgNBCUCPList()) + { + gNBList.add(gNBCUCPModel.getgNBCUName()); + setRanNetconfServers(gNBCUCPModel.getgNBCUName()); + 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/gNBCUConfig.json")) { + // Read JSON file + Object obj = jsonParser.parse(reader); + JSONArray List = (JSONArray) obj; + for (int i = 0; i < List.size(); i++) { + JSONObject gNB = (JSONObject) List.get(i); + String gNBCUName = (String) gNB.get("gNBCUName"); + Long gNBId = (Long) gNB.get("gNBId"); + Long gNBIdLength = (Long) gNB.get("gNBIdLength"); + String pLMNId = (String) gNB.get("pLMNId"); + String nFType = (String) gNB.get("nFType"); + Long nearRTRICId = (Long) gNB.get("nearRTRICId"); + String cellListVar = (String) gNB.get("cellCUList").toString(); + Object cellListObj = jsonParser.parse(cellListVar); + JSONArray cellList = (JSONArray) cellListObj; + List nRCellCUModelList = new ArrayList(); + for (int j = 0; j < cellList.size(); j++) { + JSONObject cell = (JSONObject) cellList.get(j); + Long cellLocalId = (Long) cell.get("cellLocalId"); + String plmVar = (String) cell.get("pLMNInfoList").toString(); + Object pmlVarObj = jsonParser.parse(plmVar); + JSONArray pmlList = (JSONArray) pmlVarObj; + List plmnInfoModelList = new ArrayList(); + for (int k = 0; k < pmlList.size(); k++) { + JSONObject pml = (JSONObject) pmlList.get(k); + String pLMNid = (String) pml.get("pLMNId"); + JSONObject sNSSAI = (JSONObject) pml.get("sNSSAI"); + String sNssai = (String) sNSSAI.get("sNSSAI"); + String status = (String) sNSSAI.get("status"); + JSONObject configData = (JSONObject) sNSSAI.get("configData"); + Long maxNumberOfConns = (Long) configData.get("maxNumberOfConns"); + NSSAIConfig configDataObj = new NSSAIConfig(); + configDataObj.setMaxNumberOfConns(maxNumberOfConns.intValue()); + NSSAIData nssaiData = new NSSAIData(); + nssaiData.setsNSSAI(sNssai); + nssaiData.setStatus(status); + nssaiData.setConfigData(configDataObj); + PLMNInfoModel plmnInfoModel = new PLMNInfoModel(); + plmnInfoModel.setpLMNId(pLMNid); + plmnInfoModel.setsNSSAI(nssaiData); + plmnInfoModelList.add(plmnInfoModel); + } + NRCellCUModel nrCellCUModel = new NRCellCUModel(); + nrCellCUModel.setCellLocalId(cellLocalId.intValue()); + nrCellCUModel.setpLMNInfoList(plmnInfoModelList); + nRCellCUModelList.add(nrCellCUModel); + } + GNBCUCPModel gNBModel = new GNBCUCPModel(); + gNBModel.setgNBCUName(gNBCUName); + gNBModel.setgNBId(gNBId.intValue()); + gNBModel.setgNBIdLength(gNBIdLength.intValue()); + gNBModel.setpLMNId(pLMNId); + gNBModel.setnFType(nFType); + gNBModel.setNearRTRICId(nearRTRICId.intValue()); + gNBModel.setCellCUList(nRCellCUModelList); + ranSliceConfigService.saveGNBCUCP(gNBModel); + } + } catch (Exception e) { + log.error("Properties file error", e); + } + } + } + } + for(GNBCUUPModel gNBCUUPModel:rtricModel.getgNBCUUPList()) + { + gNBList.add(gNBCUUPModel.getgNBCUUPId().toString()); + setRanNetconfServers(gNBCUUPModel.getgNBCUUPId().toString()); + } + for(GNBDUModel gNBDUModel:rtricModel.getgNBDUList()) + { + gNBList.add(gNBDUModel.getgNBDUId().toString()); + setRanNetconfServers(gNBDUModel.getgNBDUId().toString()); + } + unassignedrtRicIds.add(rtricModel.getNearRTRICId().toString()); + ricIdFunctionMapping.put(rtricModel.getNearRTRICId().toString(),gNBList); + setRanNetconfServers(rtricModel.getNearRTRICId().toString()); + } + } + catch(Exception e){ + log.error("Properties file error", e); + } + } + + public void setRanNetconfServers(String serverId) + { + try { + + 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); + + } + } + + + /** + * The function adds the cell(with nodeId passed as an argument) to its netconf + * server list if the netconf server already exists. Else it will create a new + * netconf server in the NetconfServers Table and the cell into its list. + * + * @param nodeId node Id of the cell + */ + public void setNetconfServers(String nodeId) { + + CellDetails currentCell = ransimRepo.getCellDetail(nodeId); + + Set newList = new HashSet(); + try { + if (currentCell != null) { + NetconfServers server = ransimRepo.getNetconfServer(currentCell.getServerId()); + + if (server == null) { + + server = new NetconfServers(); + server.setServerId(currentCell.getServerId()); + } else { + newList.addAll(server.getCells()); + } + + newList.add(currentCell); + server.setCells(newList); + log.info("setNetconfServers: nodeId: " + nodeId + ", X:" + currentCell.getGridX() + ", Y:" + + currentCell.getGridY() + ", ip: " + server.getIp() + ", portNum: " + server.getNetconfPort() + + ", serverId:" + currentCell.getServerId()); + + ransimRepo.mergeNetconfServers(server); + + } + + } catch (Exception eu) { + log.error("setNetconfServers Function Error", eu); + + } + } + + /** + * generateClusterFromFile() + * + * @throws IOException + */ + public void generateClusterFromFile() throws IOException { + + log.debug("Inside generateClusterFromFile"); + File dumpFile = null; + String cellDetailsString = ""; + + dumpFile = new File(fileBasePath+dumpFileName); + + BufferedReader br = null; + try { + log.debug("Reading dump file"); + br = new BufferedReader(new FileReader(dumpFile)); + + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + cellDetailsString = sb.toString(); + + TopologyDump dumpTopo = new Gson().fromJson(cellDetailsString, TopologyDump.class); + CellDetails cellsDb = new CellDetails(); + + log.info("dumpTopo.getCellList().size():" + dumpTopo.getCellList().size()); + for (int i = 0; i < dumpTopo.getCellList().size(); i++) { + Gson g = new Gson(); + String pnt = g.toJson(dumpTopo.getCellList().get(i)); + log.info("Creating Cell:" + pnt); + log.info("Creating Cell:" + dumpTopo.getCellList().get(i).getCell().getNodeId()); + + cellsDb = new CellDetails(); + cellsDb.setNodeId(dumpTopo.getCellList().get(i).getCell().getNodeId()); + cellsDb.setPhysicalCellId(dumpTopo.getCellList().get(i).getCell().getPhysicalCellId()); + cellsDb.setLongitude(dumpTopo.getCellList().get(i).getCell().getLongitude()); + cellsDb.setLatitude(dumpTopo.getCellList().get(i).getCell().getLatitude()); + cellsDb.setServerId(dumpTopo.getCellList().get(i).getCell().getPnfName()); + if (!unassignedServerIds.contains(cellsDb.getServerId())) { + unassignedServerIds.add(cellsDb.getServerId()); + } + cellsDb.setNetworkId(dumpTopo.getCellList().get(i).getCell().getNetworkId()); + + double lon = Float.valueOf(dumpTopo.getCellList().get(i).getCell().getLongitude()); + double lat = Float.valueOf(dumpTopo.getCellList().get(i).getCell().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))); + } + + cellsDb.setScreenX((float) (xx)); + cellsDb.setScreenY((float) (yy)); + + List attachedNoeds = serverIdIpNodeMapping.get(cellsDb.getServerId()); + log.info("Attaching Cell:" + dumpTopo.getCellList().get(i).getCell().getNodeId() + " to " + + cellsDb.getServerId()); + if (attachedNoeds == null) { + attachedNoeds = new ArrayList(); + } + attachedNoeds.add(cellsDb.getNodeId()); + serverIdIpNodeMapping.put(cellsDb.getServerId(), attachedNoeds); + if (attachedNoeds.size() > numberOfCellsPerNcServer) { + log.warn("Attaching Cell:" + dumpTopo.getCellList().get(i).getCell().getNodeId() + " to " + + cellsDb.getServerId() + ", But it is exceeding numberOfCellsPerNcServer " + + numberOfCellsPerNcServer); + } + ransimRepo.mergeCellDetails(cellsDb); + setNetconfServers(cellsDb.getNodeId()); + } + + dumpSessionDetails(); + + try { + + for (int i = 0; i < dumpTopo.getCellList().size(); i++) { + + String cellNodeId = dumpTopo.getCellList().get(i).getCell().getNodeId(); + + // neighbor list with the corresponding node id + CellNeighbor neighborList = ransimRepo.getCellNeighbor(cellNodeId); + // cell with the corresponding nodeId + CellDetails currentCell = ransimRepo.getCellDetail(cellNodeId); + + Set newCell = new HashSet(); + + if (currentCell != null) { + if (neighborList == null) { + neighborList = new CellNeighbor(); + neighborList.setNodeId(cellNodeId); + } + List neighboursFromFile = dumpTopo.getCellList().get(i).getNeighbor(); + log.info("Creating Neighbor for Cell :" + cellNodeId); + for (NbrDump a : neighboursFromFile) { + String id = a.getNodeId().trim(); + boolean noHo = Boolean.parseBoolean(a.getBlacklisted().trim()); + CellDetails neighborCell = ransimRepo.getCellDetail(id); + NeighborDetails neighborDetails = new NeighborDetails( + new NeihborId(currentCell.getNodeId(), neighborCell.getNodeId()), noHo); + + newCell.add(neighborDetails); + } + + neighborList.setNeighborList(newCell); + ransimRepo.mergeCellNeighbor(neighborList); + rsPciHdlr.setCollisionConfusionFromFile(cellNodeId); + + } + + } + + } catch (Exception e1) { + log.error("Exception generateClusterFromFile :", e1); + } + + try { + + long startTimeSectorNumber = System.currentTimeMillis(); + for (int i = 0; i < dumpTopo.getCellList().size(); i++) { + + CellData icellData = dumpTopo.getCellList().get(i); + CellDetails icell = ransimRepo.getCellDetail(icellData.getCell().getNodeId()); + int icount = icell.getSectorNumber(); + if (icount == 0) { + log.info("Setting sectorNumber for Cell(i) :" + icell.getNodeId()); + int jcount = 0; + for (int j = (i + 1); j < dumpTopo.getCellList().size(); j++) { + + CellData jcellData = dumpTopo.getCellList().get(j); + if (icellData.getCell().getLatitude().equals(jcellData.getCell().getLatitude())) { + if (icellData.getCell().getLongitude().equals(jcellData.getCell().getLongitude())) { + + if (icount == 0) { + icount++; + jcount = icount + 1; + } + + CellDetails jcell = ransimRepo + .getCellDetail(dumpTopo.getCellList().get(j).getCell().getNodeId()); + + jcell.setSectorNumber(jcount); + log.info("Setting sectorNumber for Cell(j) :" + jcell.getNodeId() + " icell: " + + icell.getNodeId() + " Sector number: " + jcount); + ransimRepo.mergeCellDetails(jcell); + jcount++; + if (jcount > 3) { + break; + } + } + } + } + icell.setSectorNumber(icount); + ransimRepo.mergeCellDetails(icell); + } + + } + + long endTimeSectorNumber = System.currentTimeMillis(); + log.info("Time taken for setting sector number: " + (endTimeSectorNumber - startTimeSectorNumber)); + + } catch (Exception e3) { + log.error("Exception generateClusterFromFile :", e3); + } + + } catch (Exception e) { + log.error("Exception generateClusterFromFile :", e); + + } finally { + br.close(); + } + } + + /** + * The function deletes the cell from the database with the nodeId passed in the + * arguments. It removes the cell from its neighbor's neighbor list and the + * netconf server list. + * + * @param nodeId node Id of the cell to be deleted. + * @return returns success or failure message + */ + public String deleteCellFunction(String nodeId) { + String result = "failure node dosent exist"; + log.info("deleteCellFunction called with nodeId :" + nodeId); + + try { + CellDetails deleteCelldetail = ransimRepo.getCellDetail(nodeId); + + CellNeighbor deleteCellNeighbor = ransimRepo.getCellNeighbor(nodeId); + + if (deleteCelldetail != null) { + if (deleteCellNeighbor != null) { + List cellNeighborList = ransimRepo.getCellNeighborList(); + for (CellNeighbor cellNeighbors : cellNeighborList) { + Set currentCellNeighbors = new HashSet( + cellNeighbors.getNeighborList()); + + NeihborId deleteNeighborDetail = new NeihborId(cellNeighbors.getNodeId(), + deleteCelldetail.getNodeId()); + + if (currentCellNeighbors.contains(deleteNeighborDetail)) { + log.info("Deleted Cell is Neighbor of NodeId : " + cellNeighbors.getNodeId()); + currentCellNeighbors.remove(deleteNeighborDetail); + cellNeighbors.setNeighborList(currentCellNeighbors); + ransimRepo.mergeCellNeighbor(cellNeighbors); + } + } + + deleteCellNeighbor.getNeighborList().clear(); + ransimRepo.deleteCellNeighbor(deleteCellNeighbor); + } + + ransimRepo.deleteCellDetails(deleteCelldetail); + result = "cell has been deleted from the database"; + } else { + log.info("cell id does not exist"); + result = "failure nodeId dosent exist"; + return result; + } + } catch (Exception eu) { + log.error("Exception deleteCellFunction :", eu); + result = "Exception in function"; + } + return result; + } + + /** + * Send configuration details to all the netconf server. + */ + public void sendInitialConfigAll() { + try { + dumpSessionDetails(); + List ncServers = ransimRepo.getNetconfServersList(); + for (NetconfServers netconfServers : ncServers) { + String ipPortKey = serverIdIpPortMapping.get(netconfServers.getServerId()); + if (ipPortKey == null || ipPortKey.trim().equals("")) { + log.info("No client for " + netconfServers.getServerId()); + for (String ipPortKeyStr : webSocketSessions.keySet()) { + if (!serverIdIpPortMapping.containsValue(ipPortKeyStr)) { + serverIdIpPortMapping.put(netconfServers.getServerId(), ipPortKeyStr); + ipPortKey = ipPortKeyStr; + break; + } + } + } + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + sendInitialConfig(netconfServers.getServerId()); + try { + String[] agentDetails = ipPortKey.split(":"); + new RestClient().sendMountRequestToSdnr(netconfServers.getServerId(), sdnrServerIp, + sdnrServerPort, agentDetails[0], agentDetails[1], sdnrServerUserid, + sdnrServerPassword); + } catch (Exception ex1) { + log.info("Ignoring exception", ex1); + } + + } else { + log.info("No session for " + ipPortKey); + } + } + } + } catch (Exception eu) { + log.error("Exception:", eu); + } + } + + public void sendRanInitialConfigAll() { + try { + List ncServers = ranSliceConfigService.findAllNearRTRIC(); + for (NearRTRICModel netconfServers : ncServers) { + String ipPortKey = serverIdIpPortMapping.get(netconfServers.getNearRTRICId()); + if (ipPortKey == null || ipPortKey.trim().equals("")) { + log.info("No client for " + netconfServers.getNearRTRICId()); + for (String ipPortKeyStr : webSocketSessions.keySet()) { + if (!serverIdIpPortMapping.containsValue(ipPortKeyStr)) { + serverIdIpPortMapping.put(netconfServers.getNearRTRICId().toString(), ipPortKeyStr); + ipPortKey = ipPortKeyStr; + break; + } + } + } + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + sendRanInitialConfig(netconfServers.getNearRTRICId().toString()); + try { + String[] agentDetails = ipPortKey.split(":"); + new RestClient().sendMountRequestToSdnr(netconfServers.getNearRTRICId().toString(), sdnrServerIp, + sdnrServerPort, agentDetails[0], agentDetails[1], sdnrServerUserid, + sdnrServerPassword); + } catch (Exception ex1) { + log.info("Ignoring exception", ex1); + } + + } else { + log.info("No session for " + ipPortKey); + } + } + } + } catch (Exception eu) { + log.error("Exception:", eu); + } + } + + + /** + * Sends initial configuration details of the cells for a new netconf server + * that has been started. + * + * @param ipPortKey ip address details of the netconf server + */ + public void sendInitialConfigForNewAgent(String ipPortKey, String serverId) { + try { + dumpSessionDetails(); + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + if (serverId != null && !serverId.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + String[] agentDetails = ipPortKey.split(":"); + sendInitialConfig(serverId); + new RestClient().sendMountRequestToSdnr(serverId, sdnrServerIp, sdnrServerPort, agentDetails[0], + agentDetails[1], sdnrServerUserid, sdnrServerPassword); + + } else { + log.info("No session for " + ipPortKey); + } + } else { + log.info("No serverid for " + ipPortKey); + } + } else { + log.info("Invalid ipPortKey " + ipPortKey); + } + } catch (Exception eu) { + log.info("Exception:", eu); + } + } + + public void sendRanInitialConfigForNewAgent(String ipPortKey, String serverId) { + try { + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + if (serverId != null && !serverId.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + String[] agentDetails = ipPortKey.split(":"); + sendRanInitialConfig(serverId); + new RestClient().sendMountRequestToSdnr(serverId, sdnrServerIp, sdnrServerPort, agentDetails[0], + agentDetails[1], sdnrServerUserid, sdnrServerPassword); + } else { + log.info("No session for " + ipPortKey); + } + } else { + log.info("No serverid for " + ipPortKey); + } + } else { + log.info("Invalid ipPortKey " + ipPortKey); + } + } catch (Exception eu) { + log.info("Exception:", eu); + } + } + + public void sendRanInitialConfig(String serverId) { + + try + { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + log.info("sendInitialConfig: serverId:" + serverId + ", server:" + server); + if (server == null) { + return; + } + + for(NearRTRICModel rtRicModel:rtricModelList) { + if(rtRicModel.getNearRTRICId().toString().equals(serverId)) { + getInitalConfigTree(rtRicModel,serverId); + NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin", server.getServerId(), + server.getIp(), Integer.parseInt(server.getNetconfPort())); + + netconfClient.editConfig(netconfClient.getInitialNodeSet(rtRicModel,serverId)); + } + else { + for(Map.Entry> entry : ricIdFunctionMapping.entrySet()) { + for(String value : entry.getValue()) { + if(value.equals(serverId) && rtRicModel.getNearRTRICId().toString().equals(entry.getKey())) { + getInitalConfigTree(rtRicModel,serverId); + NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin", server.getServerId(), + server.getIp(), Integer.parseInt(server.getNetconfPort())); + + netconfClient.editConfig(netconfClient.getInitialNodeSet(rtRicModel,serverId)); + } + } + } + } + } + + } + catch (Exception eu) { + log.info("Exception:", eu); + } + + } + + /** + * Gets the initial config tree from the database. + */ + private void getInitalConfigTree(NearRTRICModel rtRicModel,String serverId) { + RanNetwork ranNetwork = new RanNetwork(); + List nearRTRICList = new ArrayList<>(); + + NearRTRIC nearRTRIC = new NearRTRIC(); + nearRTRIC.setIdNearRTRIC(rtRicModel.getNearRTRICId().toString()); + Attributes attributes = new Attributes(); + attributes.setLocationName("Palmdale"); + attributes.setgNBId(rtRicModel.getgNBId().toString()); + nearRTRIC.setAttributes(attributes); + + List gNBCUUPFunctionList = new ArrayList<>(); + for(GNBCUUPModel gNBCUUPModel:rtRicModel.getgNBCUUPList()) + { + if(gNBCUUPModel.getgNBCUUPId().toString().equals(serverId) || rtRicModel.getNearRTRICId().toString().equals(serverId)) + { + GNBCUUPFunction gNBCUUPFunction = new GNBCUUPFunction(); + Attributes cUUPattributes = new Attributes(); + cUUPattributes.setgNBCUUPId(gNBCUUPModel.getgNBCUUPId().toString()); + gNBCUUPFunction.setAttributes(cUUPattributes); + gNBCUUPFunction.setIdGNBCUUPFunction(gNBCUUPModel.getgNBCUUPId().toString()); + gNBCUUPFunctionList.add(gNBCUUPFunction); + } + } + List gNBDUFunctionList = new ArrayList<>(); + for(GNBDUModel gNBDUModel:rtRicModel.getgNBDUList()) + { + if(gNBDUModel.getgNBDUId().toString().equals(serverId) || rtRicModel.getNearRTRICId().toString().equals(serverId)) + { + GNBDUFunction gNBDUFunction= new GNBDUFunction(); + Attributes dUattributes = new Attributes(); + dUattributes.setgNBId(gNBDUModel.getgNBId().toString()); + gNBDUFunction.setAttributes(dUattributes); + gNBDUFunction.setIdGNBDUFunction(gNBDUModel.getgNBDUId().toString()); + List nRCellDUList = new ArrayList<>(); + for(NRCellDUModel nRCellDUModel : gNBDUModel.getCellDUList()) + { + NRCellDU nRCellDU = new NRCellDU(); + Attributes nRCellDUattributes = new Attributes(); + nRCellDUattributes.setOperationalState(nRCellDUModel.getOperationalState()); + nRCellDUattributes.setCellState(nRCellDUModel.getCellState()); + nRCellDU.setAttributes(nRCellDUattributes); + nRCellDU.setIdNRCellDU(nRCellDUModel.getCellLocalId().toString()); + nRCellDUList.add(nRCellDU); + } + gNBDUFunction.setnRCellDU(nRCellDUList); + gNBDUFunctionList.add(gNBDUFunction); + } + } + nearRTRIC.setgNBDUFunction(gNBDUFunctionList); + nearRTRIC.setgNBCUUPFunction(gNBCUUPFunctionList); + nearRTRICList.add(nearRTRIC); + ranNetwork.setNearRTRIC(nearRTRICList); + + String ipPortKey = serverIdIpPortMapping.get(serverId); + log.info("sendInitialConfig: ipPortKey:" + ipPortKey); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(ranNetwork); + log.info("ConfigTopologyMessage: " + jsonStr); + Session session = webSocketSessions.get(ipPortKey); + RansimWebSocketServer.sendSetConfigTopologyMessage(jsonStr, session); + } + + + /** + * To send the initial configration to the netconf server. + * + * @param serverId ip address details of the netconf server + */ + public void sendInitialConfig(String serverId) { + + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + log.info("sendInitialConfig: serverId:" + serverId + ", server:" + server); + if (server == null) { + return; + } + + String ipPortKey = serverIdIpPortMapping.get(serverId); + + log.info("sendInitialConfig: ipPortKey:" + ipPortKey); + + List cellList = new ArrayList(server.getCells()); + + List config = new ArrayList(); + + for (int i = 0; i < server.getCells().size(); i++) { + Topology cell = new Topology(); + CellDetails currentCell = ransimRepo.getCellDetail(cellList.get(i).getNodeId()); + CellNeighbor neighbor = ransimRepo.getCellNeighbor(cellList.get(i).getNodeId()); + + cell.setCellId("" + currentCell.getNodeId()); + cell.setPciId(currentCell.getPhysicalCellId()); + cell.setPnfName(serverId); + + List nbrList = new ArrayList(); + Set nbrsDet = neighbor.getNeighborList(); + for (NeighborDetails cellDetails : nbrsDet) { + Neighbor nbr = new Neighbor(); + CellDetails nbrCell = ransimRepo.getCellDetail(cellDetails.getNeigbor().getNeighborCell()); + nbr.setNodeId(nbrCell.getNodeId()); + nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); + nbr.setPnfName(nbrCell.getServerId()); + nbr.setServerId(nbrCell.getServerId()); + nbr.setPlmnId(nbrCell.getNetworkId()); + nbr.setBlacklisted(cellDetails.isBlacklisted()); + nbrList.add(nbr); + } + cell.setNeighborList(nbrList); + config.add(i, cell); + } + + SetConfigTopology topo = new SetConfigTopology(); + + topo.setServerId(server.getServerId()); + String uuid = globalNcServerUuidMap.get(server.getServerId()); + if (uuid == null) { + uuid = getUuid(); + globalNcServerUuidMap.put(server.getServerId(), uuid); + } + topo.setUuid(uuid); + + topo.setTopology(config); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(topo); + log.info("ConfigTopologyMessage: " + jsonStr); + Session clSess = webSocketSessions.get(ipPortKey); + Thread.sleep(10000); + RansimWebSocketServer.sendSetConfigTopologyMessage(jsonStr, clSess); + + } catch (Exception eu) { + log.info("Exception:", eu); + } + + } + + private static String getUuid() { + return UUID.randomUUID().toString(); + } + + /** + * The function alters the database information based on the modifications made + * in the SDNR. + * + * @param message message received from the SDNR + * @param session sends the session details + * @param ipPort ip address of the netconf server + */ + 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.getCellId() + "; pci: " + modifyPci.getPciId()); + String source = "Netconf"; + CellDetails cd = ransimRepo.getCellDetail(modifyPci.getCellId()); + long pci = cd.getPhysicalCellId(); + cd.setPhysicalCellId(modifyPci.getPciId()); + ransimRepo.mergeCellDetails(cd); + rsPciHdlr.updatePciOperationsTable(modifyPci.getCellId(), source, pci, modifyPci.getPciId()); + } + + public void handleRTRICConfigFromSdnr(String message, Session session, String ipPort) { + log.info("handleReconfigureRTRICFromSDNR: message:" + message + " session:" + session + " ipPort:" + ipPort); + ConfigPLMNInfo configPLMNInfo = new Gson().fromJson(message, ConfigPLMNInfo.class); + log.info("handleReconfigureRTRICFromSDNR:" + configPLMNInfo.getSNSSAI()); + List gNBDUModelList = new ArrayList<>(); + HttpHeaders headers = new HttpHeaders(); + headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); + HttpEntity requestEntity = new HttpEntity<>(headers); + try { + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity> response = restTemplate.exchange("http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/du-list"+configPLMNInfo.getSNSSAI().get(0), HttpMethod.GET, requestEntity, + new ParameterizedTypeReference>() { + }); + gNBDUModelList = response.getBody(); + } + catch (Exception e) { + log.info("Exception:", e); + } + for(GNBDUModel gNBDUModel :gNBDUModelList) + { + String serverId = gNBDUModel.getgNBDUId().toString(); + int duCellCount = gNBDUModel.getCellDUList().size(); + for(SNSSAI sNSSAI : configPLMNInfo.getSNSSAI()) { + for(ConfigData configData : sNSSAI.getConfigData()) { + configData.setConfigValue((configData.getConfigValue())/duCellCount); + } + } + String ipPortKey = serverIdIpPortMapping.get(serverId); + log.info("sendConfigRTRICMessage: ipPortKey:" + ipPortKey); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(configPLMNInfo); + log.info("ConfigRTRICMessage: " + jsonStr); + Session duSession = webSocketSessions.get(ipPortKey); + RansimWebSocketServer.sendSetReconfigureMessage(jsonStr, duSession); + } + } + + public void handleRRMPolicyRatioUpdateFromSdnr(String message, Session session, String ipPort){ + log.info("handle RRMPolicy update: " + message ); + RRMPolicyRatio rRMPolicyRatio = new Gson().fromJson(message, RRMPolicyRatio.class); + rrmPolicyRepository.save(rRMPolicyRatio); + } + + + public void handleRRMPolicyRatioDeleteFromSdnr(String message, Session session, String ipPort) { + log.info("handle RRMPolicyRatio Delete: " + message); + RRMPolicyRatio rRMPolicyRatio = new Gson().fromJson(message, RRMPolicyRatio.class); + rrmPolicyRepository.delete(rRMPolicyRatio); + } + + public void handlePLMNInfoUpdateFromSdnr(String message, Session session, String ipPort) { + log.info("handle PLMNInfo update: "+message); + List pLMNInfoList = null; + org.onap.ransim.rest.api.models.PLMNInfoModel plmnInfoModel = new Gson().fromJson(message, + org.onap.ransim.rest.api.models.PLMNInfoModel.class); + PLMNInfo plmnInfo = new PLMNInfo(); + NSSAIConfig nSSAIConfig = new NSSAIConfig(); + nSSAIConfig.setMaxNumberOfConns((int) (plmnInfoModel.getMaxNumberOfConns())); + org.onap.ransim.rest.api.models.SNSSAI sNSSAI = new org.onap.ransim.rest.api.models.SNSSAI(); + sNSSAI.setsNSSAI(plmnInfoModel.getSnssai()); + sNSSAI.setStatus(plmnInfoModel.getStatus()); + sNSSAI.setConfigData(nSSAIConfig); + plmnInfo.setpLMNId(plmnInfoModel.getpLMNId()); + plmnInfo.setsNSSAI(sNSSAI); + try { + if (plmnInfoModel.getGnbType().equalsIgnoreCase("gnbdu")) { + org.onap.ransim.rest.api.models.NRCellDU nrCellDu = nRCellDURepository + .findById(plmnInfoModel.getNrCellId()).get(); + if (!(Objects.isNull(nrCellDu.getpLMNInfoList()))) { + pLMNInfoList = nrCellDu.getpLMNInfoList(); + } else { + pLMNInfoList = new ArrayList(); + } + pLMNInfoList.add(plmnInfo); + nrCellDu.setpLMNInfoList(pLMNInfoList); + nRCellDURepository.save(nrCellDu); + } else if (plmnInfoModel.getGnbType().equalsIgnoreCase("gnbcucp")) { + org.onap.ransim.rest.api.models.NRCellCU nrCellCu = nRCellCURepository + .findById(plmnInfoModel.getNrCellId()).get(); + if (!(Objects.isNull(nrCellCu.getpLMNInfoList()))) { + pLMNInfoList = nrCellCu.getpLMNInfoList(); + } else { + pLMNInfoList = new ArrayList(); + } + pLMNInfoList.add(plmnInfo); + nrCellCu.setpLMNInfoList(pLMNInfoList); + nRCellCURepository.save(nrCellCu); + } else { + org.onap.ransim.rest.api.models.GNBCUUPFunction gNBCUUPFunction = gNBCUUPRepository + .findById(plmnInfoModel.getGnbId()).get(); + if (!(Objects.isNull(gNBCUUPFunction.getpLMNInfoList()))) { + pLMNInfoList = gNBCUUPFunction.getpLMNInfoList(); + } else { + pLMNInfoList = new ArrayList(); + } + pLMNInfoList.add(plmnInfo); + gNBCUUPFunction.setpLMNInfoList(pLMNInfoList); + gNBCUUPRepository.save(gNBCUUPFunction); + } + } catch (NullPointerException nullPointerException) { + log.error("Record does not exist"); + } catch (Exception e) { + log.error("Unexpected error while fetching data from database: " + e); + } + } + + public void handlePLMNInfoDeleteFromSdnr(String message, Session session, String ipPort) { + log.info("handle PLMNInfo Delete: " + message); + org.onap.ransim.rest.api.models.PLMNInfoModel plmnInfoModel = new Gson().fromJson(message, + org.onap.ransim.rest.api.models.PLMNInfoModel.class); + PLMNInfo plmnInfo = new PLMNInfo(); + NSSAIConfig nSSAIConfig = new NSSAIConfig(); + nSSAIConfig.setMaxNumberOfConns((int) (plmnInfoModel.getMaxNumberOfConns())); + org.onap.ransim.rest.api.models.SNSSAI sNSSAI = new org.onap.ransim.rest.api.models.SNSSAI(); + sNSSAI.setsNSSAI(plmnInfoModel.getSnssai()); + sNSSAI.setStatus(plmnInfoModel.getStatus()); + sNSSAI.setConfigData(nSSAIConfig); + plmnInfo.setpLMNId(plmnInfoModel.getpLMNId()); + plmnInfo.setsNSSAI(sNSSAI); + // pLMNInfoRepo.delete(plmnInfo); +} + + public void handleSliceProfileUpdateFromSdnr(String message, Session session, String ipPort) { + log.info("handle SliceProfile update: "+message); + SliceProfile sliceProfile = new Gson().fromJson(message, SliceProfile.class); + sliceProfileRepository.save(sliceProfile); + } + + public void handleSliceProfileDeleteFromSdnr(String message, Session session, String ipPort) { + log.info("handle SliceProfile delete: "+message); + SliceProfile sliceProfile = new Gson().fromJson(message, SliceProfile.class); + sliceProfileRepository.delete(sliceProfile); + } + + + /** + * The function alters the database information based on the modifications made + * in the SDNR. + * + * @param message message received from the SDNR + * @param session sends the session details + * @param ipPort ip address of the netconf server + */ + 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.getCellId()); + List neighborList = new ArrayList(); + List cellList = new ArrayList(); + cellList.add(modifyNeighbor.getCellId()); + String nbrsAdd = ""; + String nbrsDel = ""; + String source = "Netconf"; + + for (int i = 0; i < modifyNeighbor.getNeighborList().size(); i++) { + if (modifyNeighbor.getNeighborList().get(i).isBlacklisted()) { + NeighborDetails nd = new NeighborDetails( + new NeihborId(modifyNeighbor.getCellId(), modifyNeighbor.getNeighborList().get(i).getNodeId()), + true); + ransimRepo.mergeNeighborDetails(nd); + cellList.add(modifyNeighbor.getNeighborList().get(i).getNodeId()); + if (nbrsAdd.equals("")) { + nbrsDel = modifyNeighbor.getNeighborList().get(i).getNodeId(); + } else { + nbrsDel += "," + modifyNeighbor.getNeighborList().get(i).getNodeId(); + } + } else { + NeighborDetails nd = new NeighborDetails( + new NeihborId(modifyNeighbor.getCellId(), modifyNeighbor.getNeighborList().get(i).getNodeId()), + false); + ransimRepo.mergeNeighborDetails(nd); + cellList.add(modifyNeighbor.getNeighborList().get(i).getNodeId()); + if (nbrsDel.equals("")) { + nbrsAdd = modifyNeighbor.getNeighborList().get(i).getNodeId(); + } else { + nbrsAdd += "," + modifyNeighbor.getNeighborList().get(i).getNodeId(); + } + } + + } + + for (String cl : cellList) { + rsPciHdlr.setCollisionConfusionFromFile(cl); + } + + log.info("neighbor list: " + neighborList); + + rsPciHdlr.updateNbrsOperationsTable(modifyNeighbor.getCellId(), source, nbrsAdd, nbrsDel); + } + + /** + * The function sends the modification made in the GUI to the netconf server. + * + * @param cellId node Id of the cell which was modified + * @param pciId PCI number of the cell which was modified + */ + public void handleModifyPciFromGui(String cellId, long pciId) { + log.info("handleModifyPciFromGUI: cellId:" + cellId + " pciId:" + pciId); + + try { + CellDetails currentCell = ransimRepo.getCellDetail(cellId); + CellNeighbor neighborList = ransimRepo.getCellNeighbor(cellId); + List nbrList = new ArrayList(); + Iterator iter = neighborList.getNeighborList().iterator(); + while (iter.hasNext()) { + NeighborDetails nbCell = iter.next(); + Neighbor nbr = new Neighbor(); + CellDetails nbrCell = ransimRepo.getCellDetail(nbCell.getNeigbor().getNeighborCell()); + + nbr.setNodeId(nbrCell.getNodeId()); + nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); + nbr.setPnfName(nbrCell.getNodeName()); + nbr.setServerId(nbrCell.getServerId()); + nbr.setPlmnId(nbrCell.getNetworkId()); + nbrList.add(nbr); + } + + String pnfName = currentCell.getServerId(); + 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); + Gson gson = new Gson(); + String jsonStr = gson.toJson(updatedPci); + if (ipPort != null && !ipPort.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPort); + if (clSess != null) { + RansimWebSocketServer.sendUpdateCellMessage(jsonStr, clSess); + log.info("handleModifyPciFromGui, message: " + jsonStr); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("No client for " + currentCell.getServerId()); + } + } + + } catch (Exception eu) { + + log.error("Exception:", eu); + } + } + + /** + * The function unmounts the connection with SDNR. + * + * @return returns null value + */ + public String stopAllSimulation() { + try { + List ncServers = ransimRepo.getNetconfServersList(); + for (NetconfServers netconfServers : ncServers) { + try { + log.info("Unmount " + netconfServers.getServerId()); + new RestClient().sendUnmountRequestToSdnr(netconfServers.getServerId(), sdnrServerIp, + sdnrServerPort, sdnrServerUserid, sdnrServerPassword); + } catch (Exception e) { + log.error("Ignore Exception:", e); + } + serverIdIpNodeMapping.clear(); + } + return "Netconf servers unmounted."; + } catch (Exception eu) { + + log.error("Exception:", eu); + return "Error"; + } + } + + + + /** + * Used to dump session details. + */ + synchronized public static void dumpSessionDetails() { + + try { + + log.info("serverIdIpPortMapping.size:" + serverIdIpPortMapping.size() + "webSocketSessions.size" + + webSocketSessions.size()); + for (String key : serverIdIpPortMapping.keySet()) { + String val = serverIdIpPortMapping.get(key); + Session sess = webSocketSessions.get(val); + log.info("ServerId:" + key + " IpPort:" + val + " Session:" + sess); + } + for (String serverId : unassignedServerIds) { + log.info("Unassigned ServerId:" + serverId); + } + for (String serverId : serverIdIpPortMapping.keySet()) { + List attachedNoeds = serverIdIpNodeMapping.get(serverId); + if (attachedNoeds != null) { + log.info("ServerId:" + serverId + " attachedNoeds.size:" + attachedNoeds.size() + " nodes:" + + attachedNoeds.toArray()); + } else { + log.info("ServerId:" + serverId + " attachedNoeds:" + null); + } + } + } catch (Exception e) { + log.info("Exception:", e); + } + } + +} + +class KeepWebsockAliveThread extends Thread { + static Logger log = Logger.getLogger(KeepWebsockAliveThread.class.getName()); + RansimControllerServices rsCtrlrServices = null; + + KeepWebsockAliveThread(RansimControllerServices ctrlr) { + rsCtrlrServices = ctrlr; + } + + @Override + public void run() { + log.info("Inside KeepWebsockAliveThread run method"); + while (true) { + for (String ipPort : RansimControllerServices.webSocketSessions.keySet()) { + try { + Session sess = RansimControllerServices.webSocketSessions.get(ipPort); + RansimWebSocketServer.sendPingMessage(sess); + log.debug("Sent ping message to Client ipPort:" + ipPort); + } catch (Exception ex1) { + } + } + try { + Thread.sleep(10000); + } catch (InterruptedException ex) { + log.error("Thread interrupted"); + } + } + } +} 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 new file mode 100644 index 0000000..2a9a655 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java @@ -0,0 +1,244 @@ +package org.onap.ransim.rest.api.services; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import org.apache.log4j.Logger; +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.OperationLog; +import org.onap.ransim.rest.api.repository.CellDetailsRepo; +import org.onap.ransim.rest.api.repository.CellNeighborRepo; +import org.onap.ransim.rest.api.repository.NeighborDetailsRepo; +import org.onap.ransim.rest.api.repository.NetconfServersRepo; +import org.onap.ransim.rest.api.repository.OperationLogRepo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class RansimRepositoryService { + + static Logger log = Logger.getLogger(RansimRepositoryService.class.getName()); + + @Autowired + CellDetailsRepo cellDetailsRepo; + + @Autowired + NetconfServersRepo netconfServersRepo; + + @Autowired + CellNeighborRepo cellNeighborRepo; + + @Autowired + NeighborDetailsRepo neighborDetailsRepo; + + @Autowired + OperationLogRepo operationLogRepo; + + /** + * Method to retrieve cell details + * @param nodeId + * @return + */ + public CellDetails getCellDetail(String nodeId) { + Optional cd = cellDetailsRepo.findById(nodeId); + CellDetails cellDetails = null; + if (cd.isPresent()) { + cellDetails = cd.get(); + } + return cellDetails; + } + + /** + * Method to retrieve netconf server details + * @param serverId + * @return + */ + public NetconfServers getNetconfServer(String serverId) { + Optional 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 cellNeighborDetails = cellNeighborRepo.findById(nodeId); + CellNeighbor cellNeighbor = null; + if (cellNeighborDetails.isPresent()) { + cellNeighbor = cellNeighborDetails.get(); + } + return cellNeighbor; + } + + /** + * Method to retrieve all cell details + * @return + */ + public List getCellDetailsList() { + Iterable cellsList = cellDetailsRepo.findAll(); + if (cellsList != null) { + return (List) cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve cells with no server ids + * @return + */ + public List getCellsWithNoServerIds() { + List cellsList = cellDetailsRepo.findCellsWithNoServerId(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve cell with collision or confusion + * @return + */ + public List getCellsWithCollisionOrConfusion() { + List cellsList = cellDetailsRepo.getCellsWithCollisionOrConfusion(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve operation log + * @return + */ + public List getOperationLogList() { + Iterable opLogList = operationLogRepo.findAll(); + if (opLogList != null) { + return (List) opLogList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve all netconf servers + * @return + */ + public List getNetconfServersList() { + Iterable serversList = netconfServersRepo.findAll(); + if (serversList != null) { + return (List) serversList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve all cell neighbors + * @return + */ + public List getCellNeighborList() { + Iterable cellNeighborList = cellNeighborRepo.findAll(); + if (cellNeighborList != null) { + return (List) 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 neighbors + * @param neighborDetails + */ + public void mergeNeighborDetails(NeighborDetails neighborDetails) { + neighborDetailsRepo.save(neighborDetails); + } + + /** + * Method to save netconf servers + * @param netconfServers + */ + public void mergeNetconfServers(NetconfServers netconfServers) { + netconfServersRepo.save(netconfServers); + } + + /** + * Method to save cell neighbors + * @param cellNeighbor + */ + public void mergeCellNeighbor(CellNeighbor cellNeighbor) { + cellNeighborRepo.save(cellNeighbor); + } + + /** + * Method to save operation log + * @param opLog + */ + public void mergeOperationLog(OperationLog opLog) { + operationLogRepo.save(opLog); + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java new file mode 100644 index 0000000..3b14100 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java @@ -0,0 +1,282 @@ +package org.onap.ransim.rest.api.services; + +import java.io.File; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import java.io.ByteArrayOutputStream; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; + + +import org.onap.ransim.rest.api.exceptions.RansimException; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.web.mapper.GNBDUModel; +import org.onap.ransim.rest.web.mapper.NRCellDUModel; +import org.onap.ransim.rest.web.mapper.NSSAIData; +import org.onap.ransim.rest.web.mapper.PLMNInfoModel; +import org.onap.ransim.rest.xml.models.FileFooter; +import org.onap.ransim.rest.xml.models.FileHeader; +import org.onap.ransim.rest.xml.models.FileSender; +import org.onap.ransim.rest.xml.models.GranularityPeriod; +import org.onap.ransim.rest.xml.models.Job; +import org.onap.ransim.rest.xml.models.ManagedElement; +import org.onap.ransim.rest.xml.models.MeasCollec; +import org.onap.ransim.rest.xml.models.MeasCollecEnd; +import org.onap.ransim.rest.xml.models.MeasCollecFile; +import org.onap.ransim.rest.xml.models.MeasData; +import org.onap.ransim.rest.xml.models.MeasInfo; +import org.onap.ransim.rest.xml.models.MeasType; +import org.onap.ransim.rest.xml.models.MeasValue; +import org.onap.ransim.rest.xml.models.ReportingPeriod; +import org.onap.ransim.rest.xml.models.Result; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class SlicingPMDataGenerator { + + static Logger logger = Logger.getLogger(SlicingPMDataGenerator.class.getName()); + + @Autowired + RANSliceConfigService ranSliceConfigService; + + double ricId11MaxVariation = 0.8; + double ricId22MaxVariation = 0.2; + + /** + * Generates closed loop PM data for all DU functions Generates PRBs for DUs in + * the ratio of 80:20 for the same nssai in different RICs + * + * @throws RansimException + */ + public void generateClosedLoopPmData(long startTime) { + try{ + String requestUrl = "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/du-list"; + List duList = sendGetRequestToransimDb(requestUrl).getBody();; +NSSAIConfig nSSAIConfig = new NSSAIConfig(); +nSSAIConfig.setdLThptPerSlice(27); +nSSAIConfig.setuLThptPerSlice(30); +nSSAIConfig.setMaxNumberOfConns(3000); + +NSSAIData nSSAIData = new NSSAIData(); +nSSAIData.setsNSSAI("001-010000"); +nSSAIData.setStatus("ACTIVE"); +nSSAIData.setGlobalSubscriberId("Customer-001"); +nSSAIData.setSubscriptionServiceType("Premium"); +nSSAIData.setConfigData(nSSAIConfig); +NSSAIData nSSAIData2 = new NSSAIData(); +nSSAIData2.setsNSSAI("001-010001"); +nSSAIData2.setStatus("ACTIVE"); +nSSAIData2.setGlobalSubscriberId("Customer-001"); +nSSAIData2.setSubscriptionServiceType("Premium"); +nSSAIData2.setConfigData(nSSAIConfig); + +PLMNInfoModel pLMNInfoModel1 = new PLMNInfoModel(); +pLMNInfoModel1.setpLMNId("310-410 "); +pLMNInfoModel1.setsNSSAI(nSSAIData); +PLMNInfoModel pLMNInfoModel2 = new PLMNInfoModel(); +pLMNInfoModel2.setpLMNId("310-411 "); +pLMNInfoModel2.setsNSSAI(nSSAIData2); + +List myPLMNInfoModelList = new ArrayList(); +myPLMNInfoModelList.add(pLMNInfoModel1); +myPLMNInfoModelList.add(pLMNInfoModel2); + + + for (GNBDUModel du : duList) { + List duCellList = du.getCellDUList(); + for (NRCellDUModel cell : duCellList ) { + cell.setpLMNInfoList(myPLMNInfoModelList); +} +} + +duList.forEach(x->logger.debug("DU : " + x)); + for (GNBDUModel du : duList) { + logger.info("Generating PM data for DU : " + du.getgNBDUName()+ " Id :" + du.getgNBDUId()); + + Map myactiveNssai = new HashMap<>(); +Map activeNssaiDetails = new HashMap(); + List duCellList = du.getCellDUList(); +logger.debug("duCellList.size : " + duCellList.size()); + int ricId = du.getNearRTRICId(); +logger.debug("RIC ID : " + ricId); + List plmnInfoList = new ArrayList<>(); + duCellList.forEach(cell -> plmnInfoList.addAll(cell.getpLMNInfoList())); + List nssaiData = new ArrayList<>(); + plmnInfoList.forEach(plmnInfo -> nssaiData.add(plmnInfo.getsNSSAI())); + nssaiData.stream().filter(nssai -> nssai.getStatus().equalsIgnoreCase("active")) + .forEach(x -> activeNssaiDetails.put(x.getsNSSAI(), x.getConfigData())); +logger.debug("Goin to produceMeasurementCollectionFile"); + + for (NRCellDUModel cell : duCellList ) { + nssaiData.stream().filter(nssai -> nssai.getStatus().equalsIgnoreCase("active")) + .forEach(x -> myactiveNssai.put(x.getsNSSAI(), cell.getCellLocalId())); + } +logger.debug("myactiveNssai.size : " + myactiveNssai.size()); + produceMeasurementCollectionFile(du, activeNssaiDetails, duCellList, ricId); + logger.info("PM data generated for DU : "+ du.getgNBDUName() + " Id: " + du.getgNBDUId()); + } +}catch(RansimException e){ + logger.debug("ERROR in closed lopp PM data generation : "); +logger.debug(e); + } catch(Exception er){ +logger.debug(er); + } +} + private void produceMeasurementCollectionFile(GNBDUModel du, Map activeNssaiDetails, + List duCellList, int ricId) throws RansimException { +logger.debug("produceMeasurementCollectionFile"); + LocalDateTime beginTime = LocalDateTime.now(); + String beginTimeString = beginTime.toString(); + MeasCollec measCollec = new MeasCollec(beginTimeString); + FileSender fileSender = new FileSender(du.getgNBDUName()); + FileHeader fileHeader = new FileHeader("Prefix", "Acme Ltd", "32.435 V10.0", measCollec, fileSender); + Random r = new Random(); + int jobId = r.nextInt((9999 - 1000) + 1) + 1000; + Job job = new Job(String.valueOf(jobId)); + ReportingPeriod reportingPeriod = new ReportingPeriod("PT900S"); + + List measTypeList = setMeasurementTypes(activeNssaiDetails); + List measValueList = setMeasurementValues(duCellList,getMaxVariation(ricId)); + + ManagedElement managedElement = new ManagedElement("r0.1", du.getgNBDUName()); + LocalDateTime grabularityEndTime = LocalDateTime.now(); + String grabularityEndTimeString = grabularityEndTime.toString(); + GranularityPeriod granularityPeriod = new GranularityPeriod(grabularityEndTimeString, "PT900S"); + MeasInfo measInfo = new MeasInfo("measInfoIsVal", job, granularityPeriod, reportingPeriod, measTypeList, + measValueList); + List measInfoList = new ArrayList(); + measInfoList.add(measInfo); + MeasData measData = new MeasData(managedElement, measInfoList); + List measDataList = new ArrayList(); + measDataList.add(measData); + LocalDateTime endTime = LocalDateTime.now(); + String endTimeString = endTime.toString(); + MeasCollecEnd measCollecEnd = new MeasCollecEnd(endTimeString); + FileFooter fileFooter = new FileFooter(measCollecEnd); + MeasCollecFile measCollecFile = new MeasCollecFile(fileHeader, measDataList, fileFooter, + "http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"); + + JAXBContext jaxbContext; + try { + jaxbContext = JAXBContext.newInstance(MeasCollecFile.class); + Marshaller marshaller = jaxbContext.createMarshaller(); + + marshaller.setProperty("jaxb.encoding", "UTF-8"); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); +ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newFactory().createXMLStreamWriter( + baos, (String) marshaller.getProperty(Marshaller.JAXB_ENCODING)); + xmlStreamWriter.writeStartDocument( + (String) marshaller.getProperty(Marshaller.JAXB_ENCODING), "1.0"); + + + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.setProperty("com.sun.xml.bind.xmlHeaders", + ""); + String startDate = beginTimeString.replace(':', '-'); + String endDate = endTimeString.replace(':', '-'); + String fileName = "./" + "A" + startDate + "-" + endDate + "-" + String.valueOf(jobId) + "-" + du.getgNBDUName() + + ".xml"; +logger.debug("Craeting file"); + marshaller.marshal(measCollecFile, new File("/tmp/ransim-install/ClosedLoopData/" + fileName)); + marshaller.marshal(measCollecFile, System.out); + marshaller.marshal(measCollecFile, xmlStreamWriter); + } catch (JAXBException e) { + throw new RansimException(e); + } +catch(Exception er){ +logger.debug(er); + } + + logger.info("measCollec: " + measCollecFile.toString()); + } + + private List setMeasurementValues(List duCellList, double ricIdVariation) { +logger.debug("setMeasurementValues"); + List measValueList = new ArrayList(); + duCellList.forEach(cell -> { + int pvalue = 1; + int prbs = cell.getPrbs(); + int prbsUsedDl = (int) (Math.random() * ricIdVariation * prbs); + int prbsUsedUl = (int) (Math.random() * ricIdVariation * prbs); + int prbsUsedDl1 = (int) (Math.random() * ricIdVariation * prbs); + int prbsUsedUl2 = (int) (Math.random() * ricIdVariation * prbs); + List resultList = new ArrayList<>(); + Result result1 = new Result(pvalue++, prbsUsedDl); + Result result2 = new Result(pvalue++, prbsUsedUl); + Result result3 = new Result(pvalue++, prbsUsedDl1); + Result result4 = new Result(pvalue++, prbsUsedUl2); + + resultList.add(result1); + resultList.add(result2); + resultList.add(result3); + resultList.add(result4); + MeasValue measValue = new MeasValue(cell.getCellLocalId(), resultList, false); + measValueList.add(measValue); + + }); + return measValueList; + } + + private double getMaxVariation(int ricId) throws RansimException { + switch (ricId) { + case 11: + // ricId11MaxVariation = + // Double.parseDouble(System.getProperty("RIC_11_VARIATION")); + return ricId11MaxVariation; + case 22: + return ricId22MaxVariation; + default: + throw new RansimException("Invalid RIC ID : valid Ids : [11,22] "); + } + } + + private List setMeasurementTypes(Map activeNssaiDetails) { + List measTypeList = new ArrayList(); + AtomicInteger pValue = new AtomicInteger(1); + activeNssaiDetails.forEach((nssai, configData) -> { + MeasType mesType1 = new MeasType("SM.PrbUsedDl." + nssai, pValue.getAndIncrement()); + MeasType mesType2 = new MeasType("SM.PrbUsedUl." + nssai, pValue.getAndIncrement()); + measTypeList.add(mesType1); + measTypeList.add(mesType2); + }); + return measTypeList; + } + + public static ResponseEntity> sendGetRequestToransimDb(String requestUrl) { + HttpHeaders headers = new HttpHeaders(); + logger.info("sending request to ransimdb : " + requestUrl); + headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); + HttpEntity requestEntity = new HttpEntity<>(headers); + try { + RestTemplate restTemplate = new RestTemplate(); + return restTemplate.exchange(requestUrl, HttpMethod.GET, requestEntity, + new ParameterizedTypeReference>() { + }); + } catch (Exception e) { + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } + } +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java index 9e56045..cee94df 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java @@ -26,16 +26,81 @@ import java.util.Map; import org.apache.log4j.Logger; import org.eclipse.persistence.internal.oxm.conversion.Base64; -import org.onap.ransim.rest.api.controller.RansimControllerServices; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import javax.net.ssl.HttpsURLConnection; +import java.net.URL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSession; +import org.slf4j.LoggerFactory; + +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import javax.net.ssl.*; +import java.io.*; +import java.security.KeyStore; +import java.security.MessageDigest; +import java.security.cert.CertificateException; +import org.apache.http.client.HttpClient; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.apache.http.client.HttpClient; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLContextBuilder; +import org.apache.http.conn.ssl.TrustSelfSignedStrategy; +import org.apache.http.impl.client.HttpClients; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.apache.http.impl.client.HttpClientBuilder; + public class RestClient { - static Logger log = Logger.getLogger(RansimControllerServices.class.getName()); +private static class NullHostnameVerifier implements HostnameVerifier { + public boolean verify(String hostname, SSLSession session) { + return true; + } + } + private static class SavingTrustManager implements X509TrustManager { + + private final X509TrustManager tm; + private X509Certificate[] chain; + + SavingTrustManager(X509TrustManager tm) { + this.tm = tm; + } + + public X509Certificate[] getAcceptedIssuers() { + + return new X509Certificate[0]; + + } + + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + throw new UnsupportedOperationException(); + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + this.chain = chain; + tm.checkServerTrusted(chain, authType); + } + } + + static Logger log = Logger.getLogger(RestClient.class.getName()); HttpHeaders createHeaders(String username, String password) { return new HttpHeaders() { @@ -70,26 +135,112 @@ public class RestClient { * agent password * @return returns the message to be passed */ - public String sendMountRequestToSdnr(String serverId, String ip, int port, String agentIp, String agentPort, + + public String sendMountRequestToSdnr(String serverId, String ip, int port, String agentIp, String agentPort, String agentUsername, String agentPassword) { + + + ResponseEntity result=null; + try{ String requestBody = " " + serverId + " admin admin " + agentIp + " " + serverId + " " + agentPort + " false false 0 20000 60000 1.1 2000 false 60 0 60"; - HttpHeaders headers = createHeaders(agentUsername, agentPassword); + + + String response = ""; + HttpsURLConnection connection = null; + BufferedReader br = null; + log.info("Change in http to https"); + char[] passphrase; + String p ="changeit"; + passphrase = p.toCharArray(); + File file = new File("jssecacerts"); + if (file.isFile() == false) { + char SEP = File.separatorChar; + File dir = new File( SEP + + "tmp" + SEP +"ransim-install"+ SEP + "config"); + file = new File(dir, "jssecacerts"); + } + log.info("Loading new KeyStores" + file + "..."); + InputStream in = new FileInputStream(file); + KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); + ks.load(in, passphrase); + in.close(); + SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( + new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()) + .loadKeyMaterial(ks, passphrase) + .build(), + NoopHostnameVerifier.INSTANCE); + + HttpClient httpClient = HttpClients.custom().setSSLSocketFactory( + socketFactory).build(); + + ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory( + httpClient); + + SSLContext context = SSLContext.getInstance("TLS"); + TrustManagerFactory tmf = + TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + tmf.init(ks); + X509TrustManager defaultTrustManager = (X509TrustManager) tmf.getTrustManagers()[0]; + SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); + context.init(null, new TrustManager[]{tm}, null); + + SSLContext.setDefault(context); + SSLSocketFactory factory = context.getSocketFactory(); + + log.info("Using Authorization"); + + SSLSocket socket = (SSLSocket) factory.createSocket(ip,port); + socket.setSoTimeout(10000); + + try{ + socket.startHandshake(); + } + catch (SSLException e) { + + log.error("Exc insocket handshake", e); + + } + + log.info("Started SSL handshake without hostname verifier..."); + + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpClientBuilder httpClientBuilder = HttpClients.custom() + .setSSLContext(SSLContext.getDefault()) + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .useSystemProperties(); + + restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build())); + + + HttpHeaders headers = createHeaders(agentUsername, agentPassword); log.info("request : " + requestBody); log.info("headers : " + headers); for (Map.Entry> entry : headers.entrySet()) { log.info("Key:" + entry.getKey() + " , Value:" + entry.getValue()); } - RestTemplate restTemplate = new RestTemplate(); - String url = "http://" + ip + ":" + port + String url = "https://" + ip + ":" + port + "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + serverId; + HttpEntity entity = new HttpEntity(requestBody, headers); - ResponseEntity result = restTemplate.exchange(url, HttpMethod.PUT, entity, String.class); + result = restTemplate.exchange(url, HttpMethod.PUT, entity, String.class); - log.info("request sent, result: " + result); - return result.toString(); + log.info("Request sent, result: " + result); + socket.close(); + } + catch (SSLException e) { + System.out.println(); + e.printStackTrace(System.out); + } + + catch (Exception e) { + + log.error("Exc in post {}", e); + } + return result.toString(); } /** diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java index 6e57945..aafb0b3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java @@ -27,12 +27,10 @@ import java.util.Properties; import javax.annotation.PostConstruct; import javax.servlet.MultipartConfigElement; +import org.apache.log4j.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; @@ -43,57 +41,51 @@ import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration -@EnableWebMvc @EnableSwagger2 @ComponentScan(basePackages = { "org.onap.*", "com.*" }) -public class RansimRestConfig extends WebMvcConfigurerAdapter { +public class RansimRestConfig { + private static final Logger log = Logger.getLogger(RansimRestConfig.class); - /** - * init. - */ - @PostConstruct - public void init() { - Properties prop = new Properties(); - try (InputStream input = new FileInputStream("rs.properties")) { - // load a properties file - prop.load(input); - } catch (Exception e) { - System.out.println("Exception Occured while loading properties file" + e); - } - } + /** + * init. + */ + @PostConstruct + public void init() { + Properties prop = new Properties(); + try (InputStream input = new FileInputStream("rs.properties")) { + // load a properties file + prop.load(input); + } catch (Exception e) { + log.error("Exception Occured while loading properties file : {} ", e); + } + } - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - } + private ApiInfo apiInfo() { + return new ApiInfoBuilder().title("Ran Simulator Controller REST API") + .description("This API helps to make queries against Ran Simulator Controller").version("3.0").build(); + } - private ApiInfo apiInfo() { - return new ApiInfoBuilder().title("Ran Simulator Controller REST API") - .description("This API helps to make queries against Ran Simulator Controller").version("3.0").build(); - } + /** + * ransimappApi . + * + * @return returns api info + */ + @Bean + public Docket ransimappApi() { + return new Docket(DocumentationType.SWAGGER_2).select() + .apis(RequestHandlerSelectors.basePackage("org.onap.ransim.rest.api")).paths(PathSelectors.any()) + .build().apiInfo(apiInfo()); + } - /** - * ransimappApi . - * - * @return returns api info - */ - @Bean - public Docket ransimappApi() { - return new Docket(DocumentationType.SWAGGER_2).select() - .apis(RequestHandlerSelectors.basePackage("org.onap.ransim.rest.api")).paths(PathSelectors.any()) - .build().apiInfo(apiInfo()); - } + /** + * MultipartConfigElement. + * + * @return returns MultipartConfigElement + */ + @Bean + public MultipartConfigElement multipartConfigElement() { + String location = System.getProperty("java.io.tmpdir"); + return new MultipartConfigElement(location); + } - /** - * MultipartConfigElement. - * - * @return returns MultipartConfigElement - */ - @Bean - public MultipartConfigElement multipartConfigElement() { - String location = System.getProperty("java.io.tmpdir"); - MultipartConfigElement mp = new MultipartConfigElement(location); - return mp; - } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestInitializer.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestInitializer.java deleted file mode 100644 index 427e871..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestInitializer.java +++ /dev/null @@ -1,49 +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.rest.config; - -import javax.servlet.MultipartConfigElement; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; - -import org.springframework.web.WebApplicationInitializer; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.servlet.DispatcherServlet; - -/** - * REST API configuration initialization. - * - * @version 0.1 - */ -public class RansimRestInitializer implements WebApplicationInitializer { - @Override - public void onStartup(ServletContext container) throws ServletException { - AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); - ctx.register(RansimRestConfig.class); - ctx.setServletContext(container); - ctx.refresh(); - ServletRegistration.Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(ctx)); - servlet.setLoadOnStartup(1); - servlet.addMapping("/api/*"); - servlet.setMultipartConfig(ctx.getBean(MultipartConfigElement.class)); - } -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellData.java new file mode 100644 index 0000000..5f42cb6 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellData.java @@ -0,0 +1,101 @@ +package org.onap.ransim.rest.web.mapper; + +/** + * + * Request mapper class + * + * @author Devendra Chauhan + * + */ +public class CellData { + private String networkId; + private String nodeId; + private Long physicalCellId; + private String pnfId; + private String sectorNumber; + private String latitude; + private String longitude; + private String notes; + + public CellData() { + + } + + public CellData(String networkId, String nodeId, Long physicalCellId, String pnfId, String sectorNumber, + String latitude, String longitude, String notes) { + super(); + this.networkId = networkId; + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + this.pnfId = pnfId; + this.sectorNumber = sectorNumber; + this.latitude = latitude; + this.longitude = longitude; + this.notes = notes; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public Long getPhysicalCellId() { + return physicalCellId; + } + + public void setPhysicalCellId(Long physicalCellId) { + this.physicalCellId = physicalCellId; + } + + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getSectorNumber() { + return sectorNumber; + } + + public void setSectorNumber(String sectorNumber) { + this.sectorNumber = sectorNumber; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellInputPayload.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellInputPayload.java new file mode 100644 index 0000000..26c489f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellInputPayload.java @@ -0,0 +1,24 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +/** + * Request Mapper Class for BulkUpoad + * + * @author Devendra Chauhan + * + */ + +public class CellInputPayload { + + List cellList; + + public List getCellList() { + return cellList; + } + + public void setCellList(List cellList) { + this.cellList = cellList; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellNbrInfoResponse.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellNbrInfoResponse.java new file mode 100644 index 0000000..0f6ef20 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellNbrInfoResponse.java @@ -0,0 +1,57 @@ +package org.onap.ransim.rest.web.mapper; + +import javax.persistence.Column; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CellNbrInfoResponse { + + + + @JsonProperty("cellId") + private String cellId; + + + + @JsonProperty("targetCellId") + private String targetCellId; + + private boolean ho; + + + public CellNbrInfoResponse(String cellId,String targetCellId,boolean ho) { + this.cellId = cellId; + this.targetCellId = targetCellId; + this.ho = ho; + + + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public String getTargetCellId() { + return targetCellId; + } + + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + + public boolean isHo() { + return ho; + } + + public void setHo(boolean ho) { + this.ho = ho; + } + + + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellObj.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellObj.java new file mode 100644 index 0000000..f12ec6d --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellObj.java @@ -0,0 +1,33 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +/** + * Request mapper class + * @author Devendra + * + */ + +public class CellObj { + + @JsonProperty("Cell") + private CellData cell; + + private List neighbor; + + public CellData getCell() { + return cell; + } + public void setCell(CellData cell) { + this.cell = cell; + } + public List getNeighbor() { + return neighbor; + } + public void setNeighbor(List neighbor) { + this.neighbor = neighbor; + } + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellPciValueObj.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellPciValueObj.java new file mode 100644 index 0000000..32c2710 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellPciValueObj.java @@ -0,0 +1,33 @@ +package org.onap.ransim.rest.web.mapper; +/** + * Request mapper Class + * @author Devendra Chauhan + * + */ + +public class CellPciValueObj { + + private String cellId; + private long pciValue; + + + public CellPciValueObj(String cellId, long pciValue) { + super(); + this.cellId = cellId; + this.pciValue = pciValue; + } + public String getCellId() { + return cellId; + } + public void setCellId(String cellId) { + this.cellId = cellId; + } + public long getPciValue() { + return pciValue; + } + public void setPciValue(long pciValue) { + this.pciValue = pciValue; + } + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/ErrorData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/ErrorData.java new file mode 100644 index 0000000..49b5979 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/ErrorData.java @@ -0,0 +1,30 @@ +package org.onap.ransim.rest.web.mapper; + +public enum ErrorData { + NO_DATA_FOUND("404", "No Data Found"), + DATA_NOT_STORED("500","Data not Saved"), + UNEXPECTED_ERROR("500","Exception Occured during the Operation"); + + private String errorCode; + private String errorMessage; + ErrorData(String errorCode, String errorMessage) { + this.errorCode=errorCode; + this.errorMessage = errorMessage; + } + public String getErrorCode() { + return errorCode; + } + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + @Override + public String toString() { + return "ErrorData [errorCode=" + errorCode + ", errorMessage=" + errorMessage + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUCPModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUCPModel.java new file mode 100644 index 0000000..b7d8bde --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUCPModel.java @@ -0,0 +1,62 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class GNBCUCPModel{ + private String gNBCUName; + private Integer gNBId; + private Integer gNBIdLength; + private String pLMNId; + private String nFType; + private List cellCUList; + private Integer nearRTRICId; + public String getgNBCUName() { + return gNBCUName; + } + public void setgNBCUName(String gNBCUName) { + this.gNBCUName = gNBCUName; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + public Integer getgNBIdLength() { + return gNBIdLength; + } + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + public String getpLMNId() { + return pLMNId; + } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + public List getCellCUList() { + return cellCUList; + } + public void setCellCUList(List cellCUList) { + this.cellCUList = cellCUList; + } + public Integer getNearRTRICId() { + return nearRTRICId; + } + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + public String getnFType() { + return nFType; + } + public void setnFType(String nFType) { + this.nFType = nFType; + } + @Override + public String toString() { + return "GNBCUCPModel [gNBCUName=" + gNBCUName + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + + ", pLMNId=" + pLMNId + ", nFType=" + nFType + ", cellCUList=" + cellCUList + ", nearRTRICId=" + + nearRTRICId + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUUPModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUUPModel.java new file mode 100644 index 0000000..46a3e7c --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUUPModel.java @@ -0,0 +1,72 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +import org.onap.ransim.rest.api.models.NearRTRIC; +import org.onap.ransim.rest.api.models.PLMNInfo; + +public class GNBCUUPModel{ + private Integer gNBCUUPId; + private Integer gNBId; + private Integer gNBIdLength; + private List pLMNInfoList; + private String resourceType; + private String metricKey; + private Integer metricValue; + private Integer nearRTRICId; + public Integer getgNBCUUPId() { + return gNBCUUPId; + } + public void setgNBCUUPId(Integer gNBCUUPId) { + this.gNBCUUPId = gNBCUUPId; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + public Integer getgNBIdLength() { + return gNBIdLength; + } + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + public String getMetricKey() { + return metricKey; + } + public void setMetricKey(String metricKey) { + this.metricKey = metricKey; + } + public Integer getMetricValue() { + return metricValue; + } + public void setMetricValue(Integer metricValue) { + this.metricValue = metricValue; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + public Integer getNearRTRICId() { + return nearRTRICId; + } + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + @Override + public String toString() { + return "GNBCUUPModel [gNBCUUPId=" + gNBCUUPId + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + + ", pLMNInfoList=" + pLMNInfoList + ", resourceType=" + resourceType + ", metricKey=" + metricKey + + ", metricValue=" + metricValue + ", nearRTRICId=" + nearRTRICId + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBDUModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBDUModel.java new file mode 100644 index 0000000..095d109 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBDUModel.java @@ -0,0 +1,70 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class GNBDUModel{ + private Integer gNBDUId; + private Integer gNBId; + private Integer gNBIdLength; + private String gNBDUName; + private String pLMNId; + private String nFType; + private List cellDUList; + private Integer nearRTRICId; + public Integer getgNBDUId() { + return gNBDUId; + } + public void setgNBDUId(Integer gNBDUId) { + this.gNBDUId = gNBDUId; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + public Integer getgNBIdLength() { + return gNBIdLength; + } + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + public String getgNBDUName() { + return gNBDUName; + } + public void setgNBDUName(String gNBDUName) { + this.gNBDUName = gNBDUName; + } + public String getpLMNId() { + return pLMNId; + } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public List getCellDUList() { + return cellDUList; + } + public void setCellDUList(List cellDUList) { + this.cellDUList = cellDUList; + } + + public Integer getNearRTRICId() { + return nearRTRICId; + } + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + public String getnFType() { + return nFType; + } + public void setnFType(String nFType) { + this.nFType = nFType; + } + @Override + public String toString() { + return "GNBDUModel [gNBDUId=" + gNBDUId + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + ", gNBDUName=" + + gNBDUName + ", pLMNId=" + pLMNId + ", nFType=" + nFType + ", cellDUList=" + cellDUList + + ", nearRTRICId=" + nearRTRICId + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellCUModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellCUModel.java new file mode 100644 index 0000000..25ebeb9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellCUModel.java @@ -0,0 +1,32 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class NRCellCUModel{ + private Integer cellLocalId; + private List pLMNInfoList; + private String resourceType; + public Integer getCellLocalId() { + return cellLocalId; + } + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + @Override + public String toString() { + return "NRCellCUModel [cellLocalId=" + cellLocalId + ", pLMNInfoList=" + pLMNInfoList + ", resourceType=" + + resourceType + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellDUModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellDUModel.java new file mode 100644 index 0000000..bc79608 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellDUModel.java @@ -0,0 +1,83 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +import javax.persistence.Column; + +public class NRCellDUModel{ + private Integer cellLocalId; + private String operationalState; + private String administrativeState; + private String cellState; + private List pLMNInfoList; + private Integer nRPCI; + private Integer nRTAC; + private String resourceType; + private Integer prbs; + + public Integer getCellLocalId() { + return cellLocalId; + } + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + public String getOperationalState() { + return operationalState; + } + public void setOperationalState(String operationalState) { + this.operationalState = operationalState; + } + public String getAdministrativeState() { + return administrativeState; + } + public void setAdministrativeState(String administrativeState) { + this.administrativeState = administrativeState; + } + public String getCellState() { + return cellState; + } + public void setCellState(String cellState) { + this.cellState = cellState; + } + public Integer getnRPCI() { + return nRPCI; + } + public void setnRPCI(Integer nRPCI) { + this.nRPCI = nRPCI; + } + public Integer getnRTAC() { + return nRTAC; + } + public void setnRTAC(Integer nRTAC) { + this.nRTAC = nRTAC; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public Integer getPrbs() { + return prbs; + } + public void setPrbs(Integer prbs) { + this.prbs = prbs; + } + + @Override + public String toString() { + return "NRCellDUModel [cellLocalId=" + cellLocalId + ", operationalState=" + operationalState + + ", administrativeState=" + administrativeState + ", cellState=" + cellState + ", pLMNInfoList=" + + pLMNInfoList + ", nRPCI=" + nRPCI + ", nRTAC=" + nRTAC + ", resourceType=" + resourceType + ", prbs=" + + prbs + "]"; + } + + + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIConfigData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIConfigData.java new file mode 100644 index 0000000..f8e11d9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIConfigData.java @@ -0,0 +1,37 @@ +package org.onap.ransim.rest.web.mapper; + +public class NSSAIConfigData{ + private Integer dLThptPerSlice; + private Integer uLThptPerSlice; + private Integer maxNumberOfConns; + private String lastUpdatedTS; + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + public Integer getMaxNumberOfConns() { + return maxNumberOfConns; + } + public void setMaxNumberOfConns(Integer maxNumberOfConns) { + this.maxNumberOfConns = maxNumberOfConns; + } + public String getLastUpdatedTS() { + return lastUpdatedTS; + } + public void setLastUpdatedTS(String lastUpdatedTS) { + this.lastUpdatedTS = lastUpdatedTS; + } + @Override + public String toString() { + return "NSSAIConfigData [dLThptPerSlice=" + dLThptPerSlice + ", uLThptPerSlice=" + uLThptPerSlice + + ", maxNumberOfConns=" + maxNumberOfConns + ", lastUpdatedTS=" + lastUpdatedTS + "]"; + } +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIData.java new file mode 100644 index 0000000..a88beeb --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIData.java @@ -0,0 +1,43 @@ +package org.onap.ransim.rest.web.mapper; + + +import org.onap.ransim.rest.api.models.NSSAIConfig; + +public class NSSAIData{ + private String sNSSAI; + private String status; + private String globalSubscriberId; + private String subscriptionServiceType; + //private Map configData; + private NSSAIConfig configData; + public String getsNSSAI() { + return sNSSAI; + } + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + public NSSAIConfig getConfigData() { + return configData; + } + public void setConfigData(NSSAIConfig configData) { + this.configData = configData; + } +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetwork.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetwork.java new file mode 100644 index 0000000..87b8cd3 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetwork.java @@ -0,0 +1,38 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; +/** + * Request mapper Class for NbrCellNetwork + * @author Devendra Chauhan + * + */ +public class NbrCellsNetwork { + //param + + private String targetCellId; + private long pciValue; + private boolean ho; + + + public String getTargetCellId() { + return targetCellId; + } + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + public long getPciValue() { + return pciValue; + } + public void setPciValue(long pciValue) { + this.pciValue = pciValue; + } + public boolean isHo() { + return ho; + } + public void setHo(boolean ho) { + this.ho = ho; + } + + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetworkResponse.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetworkResponse.java new file mode 100644 index 0000000..20697c9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetworkResponse.java @@ -0,0 +1,41 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +/** + * Response Mapper for NbrCellsNetwork + * @author Devendra Chauhan + * + */ +public class NbrCellsNetworkResponse { + + private String networkId; + //private List NbrCellsNetworkObjList; + @JsonProperty("cellsNbrList") + private List cellsNbrList; + public String getNetworkId() { + return networkId; + } + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + public List getCellsNbrList() { + return cellsNbrList; + } + public void setCellsNbrList(List cellsNbrList) { + this.cellsNbrList = cellsNbrList; + } + + + + /*public List getNbrCellsNetworkObjList() { + return NbrCellsNetworkObjList; + } + public void setNbrCellsNetworkObjList(List nbrCellsNetworkObjList) { + NbrCellsNetworkObjList = nbrCellsNetworkObjList; + }*/ + + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrList.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrList.java new file mode 100644 index 0000000..828c4c8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrList.java @@ -0,0 +1,38 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; +/** + * Mapper Class for NbrList + * @author Devendra Chauhan + * + */ +public class NbrList { + //param + + private String targetCellId; + private long pciValue; + private boolean ho; + + + public String getTargetCellId() { + return targetCellId; + } + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + public long getPciValue() { + return pciValue; + } + public void setPciValue(long pciValue) { + this.pciValue = pciValue; + } + public boolean isHo() { + return ho; + } + public void setHo(boolean ho) { + this.ho = ho; + } + + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrListResponse.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrListResponse.java new file mode 100644 index 0000000..7fa6b0e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrListResponse.java @@ -0,0 +1,29 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; +/** + * + * Response Mapper class for NbrList + * @author Devendra Chauhan + * + */ +public class NbrListResponse { + + private String cellId; + private List nbrList; + public String getCellId() { + return cellId; + } + public void setCellId(String cellId) { + this.cellId = cellId; + } + public List getNbrList() { + return nbrList; + } + public void setNbrList(List nbrList) { + this.nbrList = nbrList; + } + + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrObj.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrObj.java new file mode 100644 index 0000000..06e1edf --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrObj.java @@ -0,0 +1,27 @@ +package org.onap.ransim.rest.web.mapper; + +/** + * Mapper class for nbrObj + * @author Devendra Chauhan + * + */ +public class NbrObj { + private String targetCellId; + private boolean ho; + + public String getTargetCellId() { + return targetCellId; + } + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + public boolean isHo() { + return ho; + } + public void setHo(boolean ho) { + this.ho = ho; + } + + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NearRTRICModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NearRTRICModel.java new file mode 100644 index 0000000..4ed839e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NearRTRICModel.java @@ -0,0 +1,77 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class NearRTRICModel{ + private Integer nearRTRICId; + private Integer gNBId; + private List trackingArea; + private String resourceType; + private List gNBCUCPList; + private List gNBCUUPList; + private List gNBDUList; + private List ranNFNSSIList; + private List pLMNInfoList; + public Integer getNearRTRICId() { + return nearRTRICId; + } + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + public Integer getgNBId() { + return gNBId; + } + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + public List getTrackingArea() { + return trackingArea; + } + public void setTrackingArea(List trackingArea) { + this.trackingArea = trackingArea; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public List getRanNFNSSIList() { + return ranNFNSSIList; + } + public void setRanNFNSSIList(List ranNFNSSIList) { + this.ranNFNSSIList = ranNFNSSIList; + } + public List getgNBCUCPList() { + return gNBCUCPList; + } + public void setgNBCUCPList(List gNBCUCPList) { + this.gNBCUCPList = gNBCUCPList; + } + public List getgNBCUUPList() { + return gNBCUUPList; + } + public void setgNBCUUPList(List gNBCUUPList) { + this.gNBCUUPList = gNBCUUPList; + } + public List getgNBDUList() { + return gNBDUList; + } + public void setgNBDUList(List gNBDUList) { + this.gNBDUList = gNBDUList; + } + public List getpLMNInfoList() { + return pLMNInfoList; + } + public void setpLMNInfoList(List pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + @Override + public String toString() { + return "NearRTRICModel [nearRTRICId=" + nearRTRICId + ", gNBId=" + gNBId + ", trackingArea=" + trackingArea + + ", resourceType=" + resourceType + ", gNBCUCPList=" + gNBCUCPList + ", gNBCUUPList=" + gNBCUUPList + + ", gNBDUList=" + gNBDUList + ", ranNFNSSIList=" + ranNFNSSIList + ", pLMNInfoList=" + pLMNInfoList + + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/PLMNInfoModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/PLMNInfoModel.java new file mode 100644 index 0000000..19c9fcd --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/PLMNInfoModel.java @@ -0,0 +1,24 @@ +package org.onap.ransim.rest.web.mapper; + +public class PLMNInfoModel{ + private String pLMNId; + private NSSAIData sNSSAI; + + public String getpLMNId() { + return pLMNId; + } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + public NSSAIData getsNSSAI() { + return sNSSAI; + } + public void setsNSSAI(NSSAIData sNSSAI) { + this.sNSSAI = sNSSAI; + } + @Override + public String toString() { + return "PLMNInfoModel [pLMNId=" + pLMNId + ", sNSSAI=" + sNSSAI + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RANSliceInfoModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RANSliceInfoModel.java new file mode 100644 index 0000000..d37912b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RANSliceInfoModel.java @@ -0,0 +1,79 @@ +package org.onap.ransim.rest.web.mapper; + +import java.io.Serializable; +import java.util.List; + +public class RANSliceInfoModel implements Serializable{ + private static final long serialVersionUID = 1L; + private String ranNFNSSIId; + private List ranNSSIList; + private List nSSAIList; + private List sliceProfilesList; + private String trackingAreaList; + private String subnetStatus; + private String nsstId; + private String sliceType; + private String isShareable; + public String getRanNFNSSIId() { + return ranNFNSSIId; + } + public void setRanNFNSSIId(String ranNFNSSIId) { + this.ranNFNSSIId = ranNFNSSIId; + } + public List getRanNSSIList() { + return ranNSSIList; + } + public void setRanNSSIList(List ranNSSIList) { + this.ranNSSIList = ranNSSIList; + } + + public String getTrackingAreaList() { + return trackingAreaList; + } + public void setTrackingAreaList(String trackingAreaList) { + this.trackingAreaList = trackingAreaList; + } + public String getSubnetStatus() { + return subnetStatus; + } + public void setSubnetStatus(String subnetStatus) { + this.subnetStatus = subnetStatus; + } + public String getNsstId() { + return nsstId; + } + public void setNsstId(String nsstId) { + this.nsstId = nsstId; + } + public String getSliceType() { + return sliceType; + } + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + public String getIsShareable() { + return isShareable; + } + public List getnSSAIList() { + return nSSAIList; + } + public void setnSSAIList(List nSSAIList) { + this.nSSAIList = nSSAIList; + } + public List getSliceProfilesList() { + return sliceProfilesList; + } + public void setSliceProfilesList(List sliceProfilesList) { + this.sliceProfilesList = sliceProfilesList; + } + public void setIsShareable(String isShareable) { + this.isShareable = isShareable; + } + @Override + public String toString() { + return "RANSliceInfoModel [ranNFNSSIId=" + ranNFNSSIId + ", ranNSSIList=" + ranNSSIList + ", nSSAIList=" + nSSAIList + ", sliceProfilesList=" + sliceProfilesList + ", trackingAreaList=" + + trackingAreaList + ", subnetStatus=" + subnetStatus + ", nsstId=" + nsstId + ", sliceType=" + + sliceType + ", isShareable=" + isShareable + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyMemberModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyMemberModel.java new file mode 100644 index 0000000..268576b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyMemberModel.java @@ -0,0 +1,23 @@ +package org.onap.ransim.rest.web.mapper; + +public class RRMPolicyMemberModel{ + private String pLMNId; + private NSSAIData sNSSAI; + + public String getpLMNId() { + return pLMNId; + } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + public NSSAIData getsNSSAI() { + return sNSSAI; + } + public void setsNSSAI(NSSAIData sNSSAI) { + this.sNSSAI = sNSSAI; + } + @Override + public String toString() { + return "RRMPolicyMemberModel [pLMNId=" + pLMNId + ", sNSSAI=" + sNSSAI + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyRatioModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyRatioModel.java new file mode 100644 index 0000000..4ef2597 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyRatioModel.java @@ -0,0 +1,77 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class RRMPolicyRatioModel{ + private Integer rrmPolicyID; + private String resourceID; + private String resourceType; + private String sliceType; + private List rRMPolicyMemberList; + private String quotaType; + private Integer rRMPolicyMaxRatio; + private Integer rRMPolicyMinRatio; + private Integer rRMPolicyDedicatedRatio; + public Integer getRrmPolicyID() { + return rrmPolicyID; + } + public void setRrmPolicyID(Integer rrmPolicyID) { + this.rrmPolicyID = rrmPolicyID; + } + public String getResourceID() { + return resourceID; + } + public void setResourceID(String resourceID) { + this.resourceID = resourceID; + } + public String getResourceType() { + return resourceType; + } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + public String getSliceType() { + return sliceType; + } + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + public List getrRMPolicyMemberList() { + return rRMPolicyMemberList; + } + public void setrRMPolicyMemberList(List rRMPolicyMemberList) { + this.rRMPolicyMemberList = rRMPolicyMemberList; + } + public String getQuotaType() { + return quotaType; + } + public void setQuotaType(String quotaType) { + this.quotaType = quotaType; + } + public Integer getrRMPolicyMaxRatio() { + return rRMPolicyMaxRatio; + } + public void setrRMPolicyMaxRatio(Integer rRMPolicyMaxRatio) { + this.rRMPolicyMaxRatio = rRMPolicyMaxRatio; + } + public Integer getrRMPolicyMinRatio() { + return rRMPolicyMinRatio; + } + public void setrRMPolicyMinRatio(Integer rRMPolicyMinRatio) { + this.rRMPolicyMinRatio = rRMPolicyMinRatio; + } + public Integer getrRMPolicyDedicatedRatio() { + return rRMPolicyDedicatedRatio; + } + public void setrRMPolicyDedicatedRatio(Integer rRMPolicyDedicatedRatio) { + this.rRMPolicyDedicatedRatio = rRMPolicyDedicatedRatio; + } + @Override + public String toString() { + return "RRMPolicyRatioModel [rrmPolicyID=" + rrmPolicyID + ", resourceID=" + resourceID + ", resourceType=" + + resourceType + ", sliceType=" + sliceType + ", rRMPolicyMemberList=" + rRMPolicyMemberList + + ", quotaType=" + quotaType + ", rRMPolicyMaxRatio=" + rRMPolicyMaxRatio + ", rRMPolicyMinRatio=" + + rRMPolicyMinRatio + ", rRMPolicyDedicatedRatio=" + rRMPolicyDedicatedRatio + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/Result.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/Result.java new file mode 100644 index 0000000..8a6b789 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/Result.java @@ -0,0 +1,40 @@ +package org.onap.ransim.rest.web.mapper; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Mapper Class for Result + * + * @author Devendra Chauhan + * + */ +public class Result { + // param + @JsonProperty("attribute-name") + private String attributeName; + @JsonProperty("value") + private String value; + + public Result(String atributeName, String value) { + super(); + this.attributeName = atributeName; + this.value = value; + } + + public String getAttributeName() { + return attributeName; + } + + public void setAttributeName(String attributeName) { + this.attributeName = attributeName; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/SliceProfileModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/SliceProfileModel.java new file mode 100644 index 0000000..f08ce64 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/SliceProfileModel.java @@ -0,0 +1,92 @@ +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class SliceProfileModel{ + private String sliceProfileId; + private String sNSSAI; + private String pLMNIdList; + private Integer maxNumberofUEs; + private Integer latency; + private Integer dLThptPerSlice; + private Integer uLThptPerSlice; + private Integer maxNumberofConns; + private String uEMobilityLevel; + private String resourceSharingLevel; + private List coverageAreaList; + + public String getSliceProfileId() { + return sliceProfileId; + } + public void setSliceProfileId(String sliceProfileId) { + this.sliceProfileId = sliceProfileId; + } + public String getsNSSAI() { + return sNSSAI; + } + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + public String getpLMNIdList() { + return pLMNIdList; + } + public void setpLMNIdList(String pLMNIdList) { + this.pLMNIdList = pLMNIdList; + } + public Integer getMaxNumberofUEs() { + return maxNumberofUEs; + } + public void setMaxNumberofUEs(Integer maxNumberofUEs) { + this.maxNumberofUEs = maxNumberofUEs; + } + public Integer getLatency() { + return latency; + } + public void setLatency(Integer latency) { + this.latency = latency; + } + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + public Integer getMaxNumberofConns() { + return maxNumberofConns; + } + public void setMaxNumberofConns(Integer maxNumberofConns) { + this.maxNumberofConns = maxNumberofConns; + } + public String getuEMobilityLevel() { + return uEMobilityLevel; + } + public void setuEMobilityLevel(String uEMobilityLevel) { + this.uEMobilityLevel = uEMobilityLevel; + } + public String getResourceSharingLevel() { + return resourceSharingLevel; + } + public void setResourceSharingLevel(String resourceSharingLevel) { + this.resourceSharingLevel = resourceSharingLevel; + } + public List getCoverageAreaList() { + return coverageAreaList; + } + public void setCoverageAreaList(List coverageAreaList) { + this.coverageAreaList = coverageAreaList; + } + @Override + public String toString() { + return "SliceProfileModel [sliceProfileId=" + sliceProfileId + ", sNSSAI=" + sNSSAI + ", pLMNIdList=" + + pLMNIdList + ", maxNumberofUEs=" + maxNumberofUEs + ", latency=" + latency + ", dLThptPerSlice=" + + dLThptPerSlice + ", uLThptPerSlice=" + uLThptPerSlice + ", maxNumberofConns=" + maxNumberofConns + + ", uEMobilityLevel=" + uEMobilityLevel + ", resourceSharingLevel=" + resourceSharingLevel + + ", coverageAreaList=" + coverageAreaList + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileFooter.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileFooter.java new file mode 100644 index 0000000..20171bc --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileFooter.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class FileFooter { +private MeasCollecEnd measCollec; +public FileFooter() { + +} +public FileFooter(MeasCollecEnd measCollec) { +super(); +this.measCollec = measCollec; +} +public MeasCollecEnd getMeasCollec() { +return measCollec; +} +public void setMeasCollec(MeasCollecEnd measCollec) { +this.measCollec = measCollec; +} +@Override +public String toString() { +return "FileFooter [measCollec=" + measCollec + "]"; +} +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileHeader.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileHeader.java new file mode 100644 index 0000000..61cc6bf --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileHeader.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class FileHeader { +private String dnPrefix; +private String vendorName; +private String fileFormatVersion; +private MeasCollec measCollec; +private FileSender fileSender; +public FileHeader() { + +} +public FileHeader(String dnPrefix, String vendorName, String fileFormatVersion, MeasCollec measCollec, +FileSender fileSender) { +super(); +this.dnPrefix = dnPrefix; +this.vendorName = vendorName; +this.fileFormatVersion = fileFormatVersion; +this.measCollec = measCollec; +this.fileSender = fileSender; +} +public MeasCollec getMeasCollec() { +return measCollec; +} +public void setMeasCollec(MeasCollec measCollec) { +this.measCollec = measCollec; +} +@XmlAttribute +public String getDnPrefix() { +return dnPrefix; +} +public void setDnPrefix(String dnPrefix) { +this.dnPrefix = dnPrefix; +} +@XmlAttribute +public String getVendorName() { +return vendorName; +} +public void setVendorName(String vendorName) { +this.vendorName = vendorName; +} +@XmlAttribute +public String getFileFormatVersion() { +return fileFormatVersion; +} +public void setFileFormatVersion(String fileFormatVersion) { +this.fileFormatVersion = fileFormatVersion; +} +public FileSender getFileSender() { +return fileSender; +} +public void setFileSender(FileSender fileSender) { +this.fileSender = fileSender; +} +@Override +public String toString() { +return "FileHeader [dnPrefix=" + dnPrefix + ", vendorName=" + vendorName + ", fileFormatVersion=" ++ fileFormatVersion + ", measCollec=" + measCollec + ", fileSender=" + fileSender + "]"; +} +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileSender.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileSender.java new file mode 100644 index 0000000..ddf0b1f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileSender.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class FileSender { +private String localDn; +//private String elementType; +public FileSender() { + +} +public FileSender(String localDn) { +super(); +this.localDn = localDn; +} +@XmlAttribute +public String getLocalDn() { +return localDn; +} +public void setLocalDn(String localDn) { +this.localDn = localDn; +} +/*@XmlAttribute +public String getElementType() { +return elementType; +} +public void setElementType(String elementType) { +this.elementType = elementType; +}*/ +@Override +public String toString() { +return "FileSender [localDn=" + localDn + "]"; +} +} + + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/GranularityPeriod.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/GranularityPeriod.java new file mode 100644 index 0000000..ef9be95 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/GranularityPeriod.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class GranularityPeriod { + private String endTime; + private String duration; + + public GranularityPeriod() { + +} + + public GranularityPeriod(String endTime, String duration) { +super(); +this.endTime = endTime; +this.duration = duration; +} +@XmlAttribute +public String getEndTime() { +return endTime; +} +public void setEndTime(String endTime) { +this.endTime = endTime; +} +@XmlAttribute +public String getDuration() { +return duration; +} +public void setDuration(String duration) { +this.duration = duration; +} +@Override +public String toString() { +return "GranularityPeriod [endTime=" + endTime + ", duration=" + duration + "]"; +} +} + + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Job.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Job.java new file mode 100644 index 0000000..ec38194 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Job.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class Job { +private String jobId; +public Job() { + +} + +public Job(String jobId) { +super(); +this.jobId = jobId; +} + +@XmlAttribute +public String getJobId() { +return jobId; +} + +public void setJobId(String jobId) { +this.jobId = jobId; +} + +@Override +public String toString() { +return "Job [jobId=" + jobId + "]"; +} + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ManagedElement.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ManagedElement.java new file mode 100644 index 0000000..67da4da --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ManagedElement.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class ManagedElement { + private String swVersion; + private String localDn; +// private String userLabel; + + public ManagedElement() { + +} + public ManagedElement(String swVersion, String localDn) { +super(); +this.swVersion = swVersion; +this.localDn = localDn; +//this.userLabel = userLabel; +} +@XmlAttribute +public String getSwVersion() { +return swVersion; +} +public void setSwVersion(String swVersion) { +this.swVersion = swVersion; +} +@XmlAttribute +public String getLocalDn() { +return localDn; +} +public void setLocalDn(String localDn) { +this.localDn = localDn; +} +/* +@XmlAttribute +public String getUserLabel() { +return userLabel; +} +public void setUserLabel(String userLabel) { +this.userLabel = userLabel; +}*/ +@Override +public String toString() { +return "ManagedElement [swVersion=" + swVersion + ", localDn=" + localDn + "]"; +} + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollec.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollec.java new file mode 100644 index 0000000..d9256b6 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollec.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasCollec { +private String beginTime; + +public MeasCollec() { + +} +public MeasCollec(String beginTime) { +super(); +this.beginTime = beginTime; +} +@XmlAttribute +public String getBeginTime() { +return beginTime; +} +public void setBeginTime(String beginTime) { +this.beginTime = beginTime; +} + +@Override +public String toString() { +return "MeasCollec [beginTime=" + beginTime + "]"; +} +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecEnd.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecEnd.java new file mode 100644 index 0000000..57e84de --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecEnd.java @@ -0,0 +1,19 @@ +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasCollecEnd { +@XmlAttribute +private String endTime; +public MeasCollecEnd() { + +} + +public MeasCollecEnd(String endTime) { +super(); +this.endTime = endTime; +} +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecFile.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecFile.java new file mode 100644 index 0000000..8150144 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecFile.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasCollecFile { +@XmlAttribute +private String xmlns; + @XmlElement +private FileHeader fileHeader; + @XmlElement +private List measData; + @XmlElement +private FileFooter fileFooter; +public MeasCollecFile() { + +} +public MeasCollecFile(FileHeader fileHeader, List measData, FileFooter fileFooter,String xmlns) { +super(); +this.fileHeader = fileHeader; +this.measData = measData; +this.fileFooter = fileFooter; +this.xmlns = xmlns; +} +// public FileHeader getFileHeader() { +// return fileHeader; +// } +// public void setFileHeader(FileHeader fileHeader) { +// this.fileHeader = fileHeader; +// } +// public List getMeasData() { +// return measData; +// } +// public void setMeasData(List measData) { +// this.measData = measData; +// } +// public FileFooter getFileFooter() { +// return fileFooter; +// } +// public void setFileFooter(FileFooter fileFooter) { +// this.fileFooter = fileFooter; +// } +@Override +public String toString() { +return "MeasCollecFile [fileHeader=" + fileHeader + ", measData=" + measData + ", fileFooter=" + fileFooter ++ "]"; +} +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasData.java new file mode 100644 index 0000000..70ccd95 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasData.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +@XmlRootElement +public class MeasData { +private ManagedElement managedElement; +private List measInfo; +public MeasData() { +} +public MeasData(ManagedElement managedElement, List measInfo) { +super(); +this.managedElement = managedElement; +this.measInfo = measInfo; +} +public ManagedElement getManagedElement() { +return managedElement; +} +public void setManagedElement(ManagedElement managedElement) { +this.managedElement = managedElement; +} +public List getMeasInfo() { +return measInfo; +} +public void setMeasInfo(List measInfo) { +this.measInfo = measInfo; +} +@Override +public String toString() { +return "MeasData [managedElement=" + managedElement + ", measInfo=" + measInfo + "]"; +} + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasInfo.java new file mode 100644 index 0000000..3e50945 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasInfo.java @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +@XmlRootElement +@XmlType(propOrder={"measInfoId","job","granPeriod","repPeriod","measType","measValue"}) +public class MeasInfo { + private String measInfoId; + private Job job; + private GranularityPeriod granPeriod; + private ReportingPeriod repPeriod; + private List measType; + private List measValue; + + + public MeasInfo(String measInfoId, Job job, GranularityPeriod granPeriod, ReportingPeriod repPeriod, +List measType, List measValue) { +super(); +this.measInfoId = measInfoId; +this.job = job; +this.granPeriod = granPeriod; +this.repPeriod = repPeriod; +this.measType = measType; +this.measValue = measValue; +} + + +public MeasInfo() { +} + + +@XmlAttribute +public String getMeasInfoId() { +return measInfoId; +} + +public void setMeasInfoId(String measInfoId) { +this.measInfoId = measInfoId; +} + + +public Job getJob() { +return job; +} + + +public void setJob(Job job) { +this.job = job; +} + + +public GranularityPeriod getGranPeriod() { +return granPeriod; +} + + +public void setGranPeriod(GranularityPeriod granPeriod) { +this.granPeriod = granPeriod; +} + + +public ReportingPeriod getRepPeriod() { +return repPeriod; +} + + +public void setRepPeriod(ReportingPeriod repPeriod) { +this.repPeriod = repPeriod; +} + +public List getMeasType() { +return measType; +} + +public void setMeasType(List measType) { +this.measType = measType; +} + +public List getMeasValue() { +return measValue; +} + +public void setMeasValue(List measValue) { +this.measValue = measValue; +} + +@Override +public String toString() { +return "MeasInfo [measInfoId=" + measInfoId + ", job=" + job + ", granPeriod=" + granPeriod + ", repPeriod=" ++ repPeriod + ", measType=" + measType + ", measValue=" + measValue + "]"; +} +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasResult.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasResult.java new file mode 100644 index 0000000..b86e620 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasResult.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import java.util.List; + +public class MeasResult { +private String position; +private String result; +public MeasResult(String position, String result) { +super(); +this.position = position; +this.result = result; +} +public MeasResult() { +} + + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasType.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasType.java new file mode 100644 index 0000000..411e218 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasType.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; +@XmlRootElement +public class MeasType { + +private String measType; +private int p; +public MeasType(String measType, int p) { +super(); +this.measType = measType; +this.p = p; +} +public MeasType() { +} + +@XmlValue +public String getMeasType() { +return measType; +} +public void setMeasType(String measType) { +this.measType = measType; +} +@XmlAttribute +public int getP() { +return p; +} +public void setP(int p) { +this.p = p; +} +@Override +public String toString() { +return "MeasType [measType=" + measType + ", p=" + p + "]"; +} + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasValue.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasValue.java new file mode 100644 index 0000000..3eea932 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasValue.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +@XmlRootElement +public class MeasValue { +private Integer measObjLdn; +private List r; +public MeasValue() { + +} +public MeasValue(Integer measObjLdn, List r, boolean suspect) { +super(); +this.measObjLdn = measObjLdn; +this.r = r; +this.suspect = suspect; +} +private boolean suspect; +@XmlAttribute +public Integer getMeasObjLdn() { +return measObjLdn; +} +public void setMeasObjLdn(Integer measObjLdn) { +this.measObjLdn = measObjLdn; +} +public List getR() { +return r; +} +public void setR(List r) { +this.r = r; +} +public boolean isSuspect() { +return suspect; +} +public void setSuspect(boolean suspect) { +this.suspect = suspect; +} +@Override +public String toString() { +return "MeasValue [measObjLdn=" + measObjLdn + ", r=" + r + ", suspect=" + suspect + "]"; +} + +} + + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ReportingPeriod.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ReportingPeriod.java new file mode 100644 index 0000000..493f5b9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ReportingPeriod.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; + +public class ReportingPeriod { +@XmlAttribute + public String getDuration() { +return duration; +} + +public void setDuration(String duration) { +this.duration = duration; +} + +private String duration; +public ReportingPeriod() { +} + +public ReportingPeriod(String duration) { +super(); +this.duration = duration; +} + +@Override +public String toString() { +return "ReportingPeriod [duration=" + duration + "]"; +} + + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Result.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Result.java new file mode 100644 index 0000000..f7ff0a0 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Result.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2018 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.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; +@XmlRootElement +public class Result { +private int p; +private int measValue; +public Result() { +} +public Result(int p, int measValue) { +super(); +this.p = p; +this.measValue = measValue; +} +@XmlAttribute +public int getP() { +return p; +} +public void setP(int p) { +this.p = p; +} +@XmlValue +public double getMeasValue() { +return measValue; +} +public void setMeasValue(int measValue) { +this.measValue = measValue; +} +@Override +public String toString() { +return "Result [p=" + p + ", measValue=" + measValue + "]"; +} + +} + + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/utilities/RansimUtilities.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/utilities/RansimUtilities.java new file mode 100644 index 0000000..a4546bc --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/utilities/RansimUtilities.java @@ -0,0 +1,55 @@ +/*- + * ============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.utilities; + +/** + * + * Class with Utilities used across ransim + */ +public class RansimUtilities { + + /** + * @param angle + * @return + */ + public static double degToRadians(double angle) { + double radians = 57.2957795; + return (angle / radians); + } + + /** + * @param angle + * @return + */ + public static double metersDeglon(double angle) { + double d2r = degToRadians(angle); + return ((111415.13 * Math.cos(d2r)) - (94.55 * Math.cos(3.0 * d2r)) + (0.12 * Math.cos(5.0 * d2r))); + } + + /** + * @param angle + * @return + */ + public static double metersDeglat(double angle) { + double d2r = degToRadians(angle); + return (111132.09 - (566.05 * Math.cos(2.0 * d2r)) + (1.20 * Math.cos(4.0 * d2r)) + - (0.002 * Math.cos(6.0 * d2r))); + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java index 650bfa8..a822385 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java @@ -20,31 +20,28 @@ package org.onap.ransim.websocket.model; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; public class AdditionalMeasurements { - - private String name; - private Map hashMap = new HashMap(); - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Map getHashMap() { - return hashMap; - } - - public void setHashMap(Map hashMap) { - this.hashMap = hashMap; - } - - + + private String name; + private Map hashMap = new HashMap(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Map getHashMap() { + return hashMap; + } + + public void setHashMap(Map hashMap) { + this.hashMap = hashMap; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Attributes.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Attributes.java new file mode 100644 index 0000000..38d896f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Attributes.java @@ -0,0 +1,46 @@ +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Attributes { + + private String locationName; + private String gNBId; + private String operationalState; + private String cellState; + private String gNBCUUPId; + + public String getLocationName() { + return locationName; + } + public void setLocationName(String locationName) { + this.locationName = locationName; + } + public String getgNBId() { + return gNBId; + } + public void setgNBId(String gNBId) { + this.gNBId = gNBId; + } + 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 String getgNBCUUPId() { + return gNBCUUPId; + } + public void setgNBCUUPId(String gNBCUUPId) { + this.gNBCUUPId = gNBCUUPId; + } +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java index aa75009..c6bf224 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java @@ -21,66 +21,66 @@ package org.onap.ransim.websocket.model; public class CommonEventHeaderFm { - - private String sourceName; - private String sourceUuid; - private String reportingEntityName; - private long startEpochMicrosec; - private long lastEpochMicrosec; - - public CommonEventHeaderFm() { - super(); - // TODO Auto-generated constructor stub - } - - public CommonEventHeaderFm(String sourceName, String sourceUuid, String reportingEntityName, - long startEpochMicrosec, long lastEpochMicrosec) { - super(); - this.sourceName = sourceName; - this.sourceUuid = sourceUuid; - this.reportingEntityName = reportingEntityName; - this.startEpochMicrosec = startEpochMicrosec; - this.lastEpochMicrosec = lastEpochMicrosec; - } - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getSourceUuid() { - return sourceUuid; - } - - public void setSourceUuid(String sourceUuid) { - this.sourceUuid = sourceUuid; - } - - public long getStartEpochMicrosec() { - return startEpochMicrosec; - } - - public void setStartEpochMicrosec(long startEpochMicrosec) { - this.startEpochMicrosec = startEpochMicrosec; - } - - public long getLastEpochMicrosec() { - return lastEpochMicrosec; - } - - public void setLastEpochMicrosec(long lastEpochMicrosec) { - this.lastEpochMicrosec = lastEpochMicrosec; - } - - public String getReportingEntityName() { - return reportingEntityName; - } - - public void setReportingEntityName(String reportingEntityName) { - this.reportingEntityName = reportingEntityName; - } - + + private String sourceName; + private String sourceUuid; + private String reportingEntityName; + private long startEpochMicrosec; + private long lastEpochMicrosec; + + public CommonEventHeaderFm() { + super(); + // TODO Auto-generated constructor stub + } + + public CommonEventHeaderFm(String sourceName, String sourceUuid, String reportingEntityName, + long startEpochMicrosec, long lastEpochMicrosec) { + super(); + this.sourceName = sourceName; + this.sourceUuid = sourceUuid; + this.reportingEntityName = reportingEntityName; + this.startEpochMicrosec = startEpochMicrosec; + this.lastEpochMicrosec = lastEpochMicrosec; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getSourceUuid() { + return sourceUuid; + } + + public void setSourceUuid(String sourceUuid) { + this.sourceUuid = sourceUuid; + } + + public long getStartEpochMicrosec() { + return startEpochMicrosec; + } + + public void setStartEpochMicrosec(long startEpochMicrosec) { + this.startEpochMicrosec = startEpochMicrosec; + } + + public long getLastEpochMicrosec() { + return lastEpochMicrosec; + } + + public void setLastEpochMicrosec(long lastEpochMicrosec) { + this.lastEpochMicrosec = lastEpochMicrosec; + } + + public String getReportingEntityName() { + return reportingEntityName; + } + + public void setReportingEntityName(String reportingEntityName) { + this.reportingEntityName = reportingEntityName; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java index 9f87529..dc87d50 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java @@ -21,42 +21,42 @@ package org.onap.ransim.websocket.model; public class CommonEventHeaderPm { - - private String sourceName; - private String sourceUuid; - private long startEpochMicrosec; - private long lastEpochMicrosec; - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getSourceUuid() { - return sourceUuid; - } - - public void setSourceUuid(String sourceUuid) { - this.sourceUuid = sourceUuid; - } - - public long getStartEpochMicrosec() { - return startEpochMicrosec; - } - - public void setStartEpochMicrosec(long startEpochMicrosec) { - this.startEpochMicrosec = startEpochMicrosec; - } - - public long getLastEpochMicrosec() { - return lastEpochMicrosec; - } - - public void setLastEpochMicrosec(long lastEpochMicrosec) { - this.lastEpochMicrosec = lastEpochMicrosec; - } - + + private String sourceName; + private String sourceUuid; + private long startEpochMicrosec; + private long lastEpochMicrosec; + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getSourceUuid() { + return sourceUuid; + } + + public void setSourceUuid(String sourceUuid) { + this.sourceUuid = sourceUuid; + } + + public long getStartEpochMicrosec() { + return startEpochMicrosec; + } + + public void setStartEpochMicrosec(long startEpochMicrosec) { + this.startEpochMicrosec = startEpochMicrosec; + } + + public long getLastEpochMicrosec() { + return lastEpochMicrosec; + } + + public void setLastEpochMicrosec(long lastEpochMicrosec) { + this.lastEpochMicrosec = lastEpochMicrosec; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigData.java new file mode 100644 index 0000000..ed6cfab --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigData.java @@ -0,0 +1,33 @@ +package org.onap.ransim.websocket.model; + +public class ConfigData { + + private String configParameter; + + private int configValue; + + public String getConfigParameter() { + return configParameter; + } + + public void setConfigParameter(String configParameter) { + this.configParameter = configParameter; + } + + public int getConfigValue() { + return configValue; + } + + public void setConfigValue(int configValue) { + this.configValue = configValue; + } + + public ConfigData() { + + } + + public ConfigData(String configParameter, int configValue) { + this.configParameter= configParameter; + this.configValue = configValue; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigPLMNInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigPLMNInfo.java new file mode 100644 index 0000000..227fd8a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigPLMNInfo.java @@ -0,0 +1,38 @@ +package org.onap.ransim.websocket.model; + +import java.util.*; + +public class ConfigPLMNInfo { + + private String mcc; + private String mnc; + private List sNSSAI; + + public String getMcc() { + return mcc; + } + + public void setMcc(String mcc) { + this.mcc = mcc; + } + + public String getMnc() { + return mnc; + } + + public void setMnc(String mnc) { + this.mnc = mnc; + } + + public List getSNSSAI() { + return sNSSAI; + } + + public void setSNSSAI(List sNSSAI) { + this.sNSSAI = sNSSAI; + } + + public ConfigPLMNInfo() { + + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java index 5954408..de3c9d8 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java @@ -23,25 +23,25 @@ package org.onap.ransim.websocket.model; import java.io.Serializable; public class DeviceData implements Serializable { - - private static final long serialVersionUID = 4388248209444904611L; - - private String type; - private String message; - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return type; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getMessage() { - return message; - } + + private static final long serialVersionUID = 4388248209444904611L; + + private String type; + private String message; + + public void setType(String type) { + this.type = type; + } + + public String getType() { + return type; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } } \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java index caddc59..084a01b 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java @@ -25,33 +25,31 @@ import javax.websocket.Decoder; import javax.websocket.EndpointConfig; public class DeviceDataDecoder implements Decoder.Text { - - // public class DeviceDataDecoder implements Decoder.Text - @Override - public void destroy() { - } - - @Override - public void init(EndpointConfig arg0) { - } - - @Override - public DeviceData decode(String msgInfo) throws DecodeException { - DeviceData data = new DeviceData(); - String[] strInfo = msgInfo.split(":", 2); - if (strInfo.length < 2) { - data.setMessage(""); - } else { - data.setMessage(strInfo[1]); - } - data.setType(strInfo[0]); - return data; - } - - @Override - public boolean willDecode(String arg0) { - // TODO Auto-generated method stub - return true; - } - + + @Override + public void destroy() { + } + + @Override + public void init(EndpointConfig arg0) { + } + + @Override + public DeviceData decode(String msgInfo) throws DecodeException { + DeviceData data = new DeviceData(); + String[] strInfo = msgInfo.split(":", 2); + if (strInfo.length < 2) { + data.setMessage(""); + } else { + data.setMessage(strInfo[1]); + } + data.setType(strInfo[0]); + return data; + } + + @Override + public boolean willDecode(String arg0) { + return true; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java index 6c29929..c3f1ff0 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java @@ -25,23 +25,23 @@ import javax.websocket.Encoder; import javax.websocket.EndpointConfig; public class DeviceDataEncoder implements Encoder.Text { - - @Override - public void destroy() { - // TODO Auto-generated method stub - - } - - @Override - public void init(EndpointConfig arg0) { - // TODO Auto-generated method stub - - } - - @Override - public String encode(DeviceData msg) throws EncodeException { - String result = msg.getType() + ":" + msg.getMessage(); - return result; - } - + + @Override + public void destroy() { + // TODO Auto-generated method stub + + } + + @Override + public void init(EndpointConfig arg0) { + // TODO Auto-generated method stub + + } + + @Override + public String encode(DeviceData msg) throws EncodeException { + String result = msg.getType() + ":" + msg.getMessage(); + return result; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java index ec340f5..b89f967 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java @@ -21,35 +21,35 @@ package org.onap.ransim.websocket.model; public class EventFm { - - private CommonEventHeaderFm commonEventHeader; - private FaultFields faultFields; - - public EventFm(CommonEventHeaderFm commonEventHeader, FaultFields faultFields) { - super(); - this.commonEventHeader = commonEventHeader; - this.faultFields = faultFields; - } - - public EventFm() { - super(); - // TODO Auto-generated constructor stub - } - - public CommonEventHeaderFm getCommonEventHeader() { - return commonEventHeader; - } - - public void setCommonEventHeader(CommonEventHeaderFm commonEventHeader) { - this.commonEventHeader = commonEventHeader; - } - - public FaultFields getFaultFields() { - return faultFields; - } - - public void setFaultFields(FaultFields faultFields) { - this.faultFields = faultFields; - } - + + private CommonEventHeaderFm commonEventHeader; + private FaultFields faultFields; + + public EventFm(CommonEventHeaderFm commonEventHeader, FaultFields faultFields) { + super(); + this.commonEventHeader = commonEventHeader; + this.faultFields = faultFields; + } + + public EventFm() { + super(); + // TODO Auto-generated constructor stub + } + + public CommonEventHeaderFm getCommonEventHeader() { + return commonEventHeader; + } + + public void setCommonEventHeader(CommonEventHeaderFm commonEventHeader) { + this.commonEventHeader = commonEventHeader; + } + + public FaultFields getFaultFields() { + return faultFields; + } + + public void setFaultFields(FaultFields faultFields) { + this.faultFields = faultFields; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java index f6dbb63..f9e2f8b 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java @@ -21,24 +21,24 @@ package org.onap.ransim.websocket.model; public class EventPm { - - private CommonEventHeaderPm commonEventHeader; - private Measurement measurement; - - public CommonEventHeaderPm getCommonEventHeader() { - return commonEventHeader; - } - - public void setCommonEventHeader(CommonEventHeaderPm commonEventHeader) { - this.commonEventHeader = commonEventHeader; - } - - public Measurement getMeasurement() { - return measurement; - } - - public void setMeasurement(Measurement measurement) { - this.measurement = measurement; - } - + + private CommonEventHeaderPm commonEventHeader; + private Measurement measurement; + + public CommonEventHeaderPm getCommonEventHeader() { + return commonEventHeader; + } + + public void setCommonEventHeader(CommonEventHeaderPm commonEventHeader) { + this.commonEventHeader = commonEventHeader; + } + + public Measurement getMeasurement() { + return measurement; + } + + public void setMeasurement(Measurement measurement) { + this.measurement = measurement; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java index ebf31f7..4d9b1e8 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java @@ -23,66 +23,65 @@ package org.onap.ransim.websocket.model; import java.util.Map; public class FaultFields { - - private String alarmCondition; - private String eventSourceType; - private String specificProblem; - private String eventSeverity; - private Map alarmAdditionalInformation; - - public FaultFields() { - super(); - // TODO Auto-generated constructor stub - } - - public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, - String eventSeverity, Map alarmAdditionalInformation) { - super(); - this.alarmCondition = alarmCondition; - this.eventSourceType = eventSourceType; - this.specificProblem = specificProblem; - this.eventSeverity = eventSeverity; - this.alarmAdditionalInformation = alarmAdditionalInformation; - } - - public String getAlarmCondition() { - return alarmCondition; - } - - public void setAlarmCondition(String alarmCondition) { - this.alarmCondition = alarmCondition; - } - - public String getEventSourceType() { - return eventSourceType; - } - - public void setEventSourceType(String eventSourceType) { - this.eventSourceType = eventSourceType; - } - - public String getSpecificProblem() { - return specificProblem; - } - - public void setSpecificProblem(String specificProblem) { - this.specificProblem = specificProblem; - } - - public String getEventSeverity() { - return eventSeverity; - } - - public void setEventSeverity(String eventSeverity) { - this.eventSeverity = eventSeverity; - } - - public Map getAlarmAdditionalInformation() { - return alarmAdditionalInformation; - } - - public void setAlarmAdditionalInformation(Map alarmAdditionalInformation) { - this.alarmAdditionalInformation = alarmAdditionalInformation; - } - + + private String alarmCondition; + private String eventSourceType; + private String specificProblem; + private String eventSeverity; + private Map alarmAdditionalInformation; + + public FaultFields() { + super(); + } + + public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, String eventSeverity, + Map alarmAdditionalInformation) { + super(); + this.alarmCondition = alarmCondition; + this.eventSourceType = eventSourceType; + this.specificProblem = specificProblem; + this.eventSeverity = eventSeverity; + this.alarmAdditionalInformation = alarmAdditionalInformation; + } + + public String getAlarmCondition() { + return alarmCondition; + } + + public void setAlarmCondition(String alarmCondition) { + this.alarmCondition = alarmCondition; + } + + public String getEventSourceType() { + return eventSourceType; + } + + public void setEventSourceType(String eventSourceType) { + this.eventSourceType = eventSourceType; + } + + public String getSpecificProblem() { + return specificProblem; + } + + public void setSpecificProblem(String specificProblem) { + this.specificProblem = specificProblem; + } + + public String getEventSeverity() { + return eventSeverity; + } + + public void setEventSeverity(String eventSeverity) { + this.eventSeverity = eventSeverity; + } + + public Map getAlarmAdditionalInformation() { + return alarmAdditionalInformation; + } + + public void setAlarmAdditionalInformation(Map alarmAdditionalInformation) { + this.alarmAdditionalInformation = alarmAdditionalInformation; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java index c11ab64..ceb5922 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java @@ -24,14 +24,14 @@ import java.util.List; public class FmMessage { - List fmEventList; - - public void setFmEventList(List data) { - this.fmEventList = data; - } + List fmEventList; + + public void setFmEventList(List data) { + this.fmEventList = data; + } + + public List getFmEventList() { + return fmEventList; + } - public List getFmEventList() { - return fmEventList; - } - } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBCUUPFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBCUUPFunction.java new file mode 100644 index 0000000..6c48c4f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBCUUPFunction.java @@ -0,0 +1,31 @@ +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GNBCUUPFunction { + + private String idGNBCUUPFunction; + + private Attributes attributes; + + public String getIdGNBCUUPFunction() { + return idGNBCUUPFunction; + } + public void setIdGNBCUUPFunction(String idGNBCUUPFunction) { + this.idGNBCUUPFunction = idGNBCUUPFunction; + } + public Attributes getAttributes() { + return attributes; + } + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + + public GNBCUUPFunction() + { + + } + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBDUFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBDUFunction.java new file mode 100644 index 0000000..985a399 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBDUFunction.java @@ -0,0 +1,40 @@ +package org.onap.ransim.websocket.model; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GNBDUFunction { + + private String idGNBDUFunction; + + private Attributes attributes; + + @JsonProperty("NRCellDU") + public List nRCellDU; + + public String getIdGNBDUFunction() { + return idGNBDUFunction; + } + public void setIdGNBDUFunction(String idGNBDUFunction) { + this.idGNBDUFunction = idGNBDUFunction; + } + public Attributes getAttributes() { + return attributes; + } + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + public List getnRCellDU() { + return nRCellDU; + } + public void setnRCellDU(List nRCellDU) { + this.nRCellDU = nRCellDU; + } + public GNBDUFunction() + { + + } +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java index 8f9de10..0417d81 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java @@ -22,25 +22,24 @@ package org.onap.ransim.websocket.model; import java.util.List; public class Measurement { - - private int measurementInterval; - private List additionalMeasurements; - - public int getMeasurementInterval() { - return measurementInterval; - } - - public void setMeasurementInterval(int measurementInterval) { - this.measurementInterval = measurementInterval; - } - - public List getAdditionalMeasurements() { - return additionalMeasurements; - } - - public void setAdditionalMeasurements( - List additionalMeasurements) { - this.additionalMeasurements = additionalMeasurements; - } - + + private int measurementInterval; + private List additionalMeasurements; + + public int getMeasurementInterval() { + return measurementInterval; + } + + public void setMeasurementInterval(int measurementInterval) { + this.measurementInterval = measurementInterval; + } + + public List getAdditionalMeasurements() { + return additionalMeasurements; + } + + public void setAdditionalMeasurements(List additionalMeasurements) { + this.additionalMeasurements = additionalMeasurements; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java index da4bf92..295b3bf 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java @@ -21,13 +21,19 @@ package org.onap.ransim.websocket.model; public class MessageTypes { - public final static String RC_TO_HC_FMDATA = "FmData"; - public final static String RC_TO_HC_PMDATA = "PmData"; - public final static String RC_TO_HC_SETCONFIGTOPO = "SetConfigTopology"; - public final static String RC_TO_HC_UPDCELL = "UpdateCell"; - public final static String RC_TO_HC_PING = "ping"; - - public final static String HC_TO_RC_MODPCI = "ModifyPci"; - public final static String HC_TO_RC_MODANR = "ModifyAnr"; - + public final static String RC_TO_HC_FMDATA = "FmData"; + public final static String RC_TO_HC_PMDATA = "PmData"; + public final static String RC_TO_HC_SETCONFIGTOPO = "INITIAL_CONFIG"; + public final static String RC_TO_HC_UPDCELL = "UpdateCell"; + public final static String RC_TO_HC_PING = "PING"; + public final static String RC_TO_HC_PMFILEDATA = "RC_TO_HC_PMFILEDATA"; + public final static String HC_TO_RC_MODPCI = "ModifyPci"; + public final static String HC_TO_RC_MODANR = "ModifyAnr"; + public final static String HC_TO_RC_RTRIC = "RTRIC_CONFIG"; + public final static String HC_TO_RC_RRM_POLICY = "HC_TO_RC_RRM_POLICY"; + public final static String HC_TO_RC_PLMN = "HC_TO_RC_PLMN"; + public final static String HC_TO_RC_SLICE_PROFILE = "HC_TO_RC_SLICE_PROFILE"; + public final static String HC_TO_RC_RRM_POLICY_DEL = "HC_TO_RC_RRM_POLICY_DEL"; + public final static String HC_TO_RC_PLMN_DEL = "HC_TO_RC_PLMN_DEL"; + public final static String HC_TO_RC_SLICE_PROFILE_DEL = "HC_TO_RC_SLICE_PROFILE_DEL"; } 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 30ec5d0..209c5fd 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 @@ -23,33 +23,33 @@ package org.onap.ransim.websocket.model; import java.util.List; public class ModifyNeighbor { - - private String pnfName; - private String cellId; - private List neighborList; - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public List getNeighborList() { - return neighborList; - } - - public void setNeighborList(List neighborList) { - this.neighborList = neighborList; - } - + + private String pnfName; + private String cellId; + private List neighborList; + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public List getNeighborList() { + return neighborList; + } + + public void setNeighborList(List neighborList) { + this.neighborList = neighborList; + } + } 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 index 6a52624..7214ae8 100644 --- 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 @@ -24,89 +24,84 @@ import java.util.List; public class ModifyPci { - private String pnfName; - - private long pciId; - - private String cellId; - - private List neighborList; - - public long getPciId() { - return pciId; - } - - public void setPciId(long pciId) { - this.pciId = pciId; - } - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - @Override - public String toString() { - return "ModifyPci [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + "neighborList:" - + neighborList + "]"; - } - - public ModifyPci() { - // TODO Auto-generated constructor stub - } - - /** - * Modify Pci value from sdnr. - * - * @param pnfName - * server id name - * @param pciId - * pci number - * @param cellId - * node id for the cell - * @param neighborList - * neighbor list for the cell - */ - public ModifyPci(String pnfName, long pciId, String cellId, List neighborList) { - super(); - this.pnfName = pnfName; - this.pciId = pciId; - this.cellId = cellId; - this.neighborList = neighborList; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public List getNeighborList() { - return neighborList; - } - - public void setNeighborList(List 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 (pnfName == null || pnfName.trim().equals("")) { - return false; - } - if (cellId == null || cellId.trim().equals("")) { - return false; - } - return true; - } + private String pnfName; + + private long pciId; + + private String cellId; + + private List neighborList; + + public long getPciId() { + return pciId; + } + + public void setPciId(long pciId) { + this.pciId = pciId; + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + @Override + public String toString() { + return "ModifyPci [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + "neighborList:" + + neighborList + "]"; + } + + public ModifyPci() { + } + + /** + * Modify Pci value from sdnr. + * + * @param pnfName server id name + * @param pciId pci number + * @param cellId node id for the cell + * @param neighborList neighbor list for the cell + */ + public ModifyPci(String pnfName, long pciId, String cellId, List neighborList) { + super(); + this.pnfName = pnfName; + this.pciId = pciId; + this.cellId = cellId; + this.neighborList = neighborList; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public List getNeighborList() { + return neighborList; + } + + public void setNeighborList(List 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 (pnfName == null || pnfName.trim().equals("")) { + return false; + } + if (cellId == null || cellId.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 new file mode 100644 index 0000000..01d51e9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java @@ -0,0 +1,32 @@ +package org.onap.ransim.websocket.model; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class NRCellDU { + + private String idNRCellDU; + + private Attributes attributes; + + public String getIdNRCellDU() { + return idNRCellDU; + } + public void setIdNRCellDU(String idNRCellDU) { + this.idNRCellDU = idNRCellDU; + } + public Attributes getAttributes() { + return attributes; + } + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + public NRCellDU(Attributes attributes) { + super(); + this.attributes = attributes; + } + public NRCellDU() + { + + } +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NearRTRIC.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NearRTRIC.java new file mode 100644 index 0000000..47e1ef8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NearRTRIC.java @@ -0,0 +1,48 @@ +package org.onap.ransim.websocket.model; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class NearRTRIC { + + private String idNearRTRIC; + + private Attributes attributes; + + @JsonProperty("GNBDUFunction") + private List gNBDUFunction; + + @JsonProperty("GNBCUUPFunction") + private List gNBCUUPFunction; + + public String getIdNearRTRIC () { + return idNearRTRIC; + } + public void setIdNearRTRIC(String idNearRTRIC) { + this.idNearRTRIC = idNearRTRIC; + } + public Attributes getAttributes() { + return attributes; + } + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + public List getgNBDUFunction() { + return gNBDUFunction; + } + public void setgNBDUFunction(List gNBDUFunction) { + this.gNBDUFunction = gNBDUFunction; + } + public List getgNBCUUPFunction() { + return gNBCUUPFunction; + } + public void setgNBCUUPFunction(List gNBCUUPFunction) { + this.gNBCUUPFunction = gNBCUUPFunction; + } + public NearRTRIC() + { + + } +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java index 65c6940..59d9659 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java @@ -22,67 +22,68 @@ package org.onap.ransim.websocket.model; public class Neighbor { - private String plmnId; - private String nodeId; - private long physicalCellId; - private String serverId; - private String pnfName; - private boolean blacklisted; - - public String getPlmnId() { - return plmnId; - } - - public void setPlmnId(String plmnId) { - this.plmnId = plmnId; - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public long getPhysicalCellId() { - return physicalCellId; - } - - public void setPhysicalCellId(long physicalCellId) { - this.physicalCellId = physicalCellId; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public Neighbor() { - // TODO Auto-generated constructor stub - } - - public boolean isBlacklisted() { - return blacklisted; - } - - public void setBlacklisted(boolean blacklisted) { - this.blacklisted = blacklisted; - } - @Override - public String toString() { - return "Neighbor [nodeId=" + nodeId + ", physicalCellId=" + physicalCellId + ", serverId=" + serverId - + ", pnfName=" + pnfName + "]"; - } + private String plmnId; + private String nodeId; + private long physicalCellId; + private String serverId; + private String pnfName; + private boolean blacklisted; + + public String getPlmnId() { + return plmnId; + } + + public void setPlmnId(String plmnId) { + this.plmnId = plmnId; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public long getPhysicalCellId() { + return physicalCellId; + } + + public void setPhysicalCellId(long physicalCellId) { + this.physicalCellId = physicalCellId; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public Neighbor() { + // TODO Auto-generated constructor stub + } + + public boolean isBlacklisted() { + return blacklisted; + } + + public void setBlacklisted(boolean blacklisted) { + this.blacklisted = blacklisted; + } + + @Override + public String toString() { + return "Neighbor [nodeId=" + nodeId + ", physicalCellId=" + physicalCellId + ", serverId=" + serverId + + ", pnfName=" + pnfName + "]"; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java index 5b7f41a..4bccb6d 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java @@ -21,31 +21,33 @@ package org.onap.ransim.websocket.model; public class NeighborHo { - - private String nodeId; - private long pciId; - private boolean blacklisted; - - public String getNodeId() { - return nodeId; - } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public long getPciId() { - return pciId; - } - public void setPciId(long pciId) { - this.pciId = pciId; - } - public boolean isBlacklisted() { - return blacklisted; - } - public void setBlacklisted(boolean blacklisted) { - this.blacklisted = blacklisted; - } - - - + + private String nodeId; + private long pciId; + private boolean blacklisted; + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public long getPciId() { + return pciId; + } + + public void setPciId(long pciId) { + this.pciId = pciId; + } + + public boolean isBlacklisted() { + return blacklisted; + } + + public void setBlacklisted(boolean blacklisted) { + this.blacklisted = blacklisted; + } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java index 3fb63b7..9bdf27a 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java @@ -24,14 +24,14 @@ import java.util.List; public class PmMessage { - List eventPmList; - - public void setEventPmList(List data) { - this.eventPmList = data; - } + List eventPmList; + + public void setEventPmList(List data) { + this.eventPmList = data; + } + + public List getEventPmList() { + return eventPmList; + } - public List getEventPmList() { - return eventPmList; - } - } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RanNetwork.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RanNetwork.java new file mode 100644 index 0000000..e03f9f3 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RanNetwork.java @@ -0,0 +1,47 @@ +/*- + * ============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; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RanNetwork { + + @JsonProperty("NearRTRIC") + private List nearRTRIC; + + public List getNearRTRIC() { + return nearRTRIC; + } + + public void setNearRTRIC(List nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + + public RanNetwork() + { + + } + +} + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SNSSAI.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SNSSAI.java new file mode 100644 index 0000000..5deddc0 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SNSSAI.java @@ -0,0 +1,31 @@ +package org.onap.ransim.websocket.model; + +import java.util.*; + +public class SNSSAI { + + private String sNssai; + + private List configData; + + public String getSNssai() { + return sNssai; + } + + public void setSNssai(String sNssai) { + this.sNssai = sNssai; + } + + public List getConfigData() { + return configData; + } + + public void setConfigData(List configData) { + this.configData = configData; + } + + public SNSSAI() { + + } + +} \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java index 9b22ebd..d61e5c3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java @@ -24,74 +24,70 @@ import java.util.List; public class SetConfigTopology { - private String serverId; - private String uuid; - private String ip; - private String netconfPort; - private List topology; - - public SetConfigTopology() { - - } - - /** - * Cell details for the given netconf server. - * - * @param serverId - * netconf server id - * @param ip - * ip address - * @param netconfPort - * port number - * @param topology - * cell topology for given server id - */ - public SetConfigTopology(String serverId, String ip, String netconfPort, List topology) { - super(); - this.serverId = serverId; - this.ip = ip; - this.netconfPort = netconfPort; - this.topology = topology; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getNetconfPort() { - return netconfPort; - } - - public void setNetconfPort(String netconfPort) { - this.netconfPort = netconfPort; - } - - public List getTopology() { - return topology; - } - - public void setTopology(List topology) { - this.topology = topology; - } + private String serverId; + private String uuid; + private String ip; + private String netconfPort; + private List topology; + + public SetConfigTopology() { + + } + + /** + * Cell details for the given netconf server. + * + * @param serverId netconf server id + * @param ip ip address + * @param netconfPort port number + * @param topology cell topology for given server id + */ + public SetConfigTopology(String serverId, String ip, String netconfPort, List topology) { + super(); + this.serverId = serverId; + this.ip = ip; + this.netconfPort = netconfPort; + this.topology = topology; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getNetconfPort() { + return netconfPort; + } + + public void setNetconfPort(String netconfPort) { + this.netconfPort = netconfPort; + } + + public List getTopology() { + return topology; + } + + public void setTopology(List topology) { + this.topology = topology; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SlicingPmMessage.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SlicingPmMessage.java new file mode 100644 index 0000000..13a6b4d --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SlicingPmMessage.java @@ -0,0 +1,83 @@ +/*- + * ============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; + +public class SlicingPmMessage { + + private String sourceName; + private String fileName; + private double startEpochMicrosec; + private double lastEpochMicrosec; + private String pmData; + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public double getStartEpochMicrosec() { + return startEpochMicrosec; + } + + public void setStartEpochMicrosec(double startEpochMicrosec) { + this.startEpochMicrosec = startEpochMicrosec; + } + + public double getLastEpochMicrosec() { + return lastEpochMicrosec; + } + + public void setLastEpochMicrosec(double lastEpochMicrosec) { + this.lastEpochMicrosec = lastEpochMicrosec; + } + + public String getPmData() { + return pmData; + } + + public void setPmData(String pmData) { + this.pmData = pmData; + } + + public SlicingPmMessage(String sourceName, String fileName, double startEpochMicrosec, double lastEpochMicrosec, String pmData) { + this.sourceName = sourceName; + this.fileName = fileName; + this.startEpochMicrosec = startEpochMicrosec; + this.lastEpochMicrosec = lastEpochMicrosec; + this.pmData = pmData; + } + + public SlicingPmMessage() { + + } + +} 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 b99f64a..9869ea4 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 @@ -24,73 +24,69 @@ import java.util.List; public class Topology { - private String pnfName; - - private long pciId; - - private String cellId; - - private List neighborList; - - public long getPciId() { - return pciId; - } - - public void setPciId(long pciId) { - this.pciId = pciId; - } - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public List getNeighborList() { - return neighborList; - } - - public void setNeighborList(List neighborList) { - this.neighborList = neighborList; - } - - @Override - public String toString() { - return "Topology [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + ", neighborList = " - + neighborList + "]"; - } - - /** - * Contails the necessary cell details. - * - * @param pnfName - * server id name - * @param pciId - * pci number - * @param cellId - * node id for the cel - * @param neighborList - * neighbor list for the cell - */ - public Topology(String pnfName, long pciId, String cellId, List neighborList) { - super(); - this.pnfName = pnfName; - this.pciId = pciId; - this.cellId = cellId; - this.neighborList = neighborList; - } - - public Topology() { - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } + private String pnfName; + + private long pciId; + + private String cellId; + + private List neighborList; + + public long getPciId() { + return pciId; + } + + public void setPciId(long pciId) { + this.pciId = pciId; + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public List getNeighborList() { + return neighborList; + } + + public void setNeighborList(List neighborList) { + this.neighborList = neighborList; + } + + @Override + public String toString() { + return "Topology [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + ", neighborList = " + + neighborList + "]"; + } + + /** + * Contails the necessary cell details. + * + * @param pnfName server id name + * @param pciId pci number + * @param cellId node id for the cel + * @param neighborList neighbor list for the cell + */ + public Topology(String pnfName, long pciId, String cellId, List neighborList) { + super(); + this.pnfName = pnfName; + this.pciId = pciId; + this.cellId = cellId; + this.neighborList = neighborList; + } + + public Topology() { + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java index 5794fb1..e515172 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java @@ -22,64 +22,60 @@ package org.onap.ransim.websocket.model; public class UpdateCell { - private String serverId; - private String ip; - private String netconfPort; - Topology oneCell; + private String serverId; + private String ip; + private String netconfPort; + Topology oneCell; - public UpdateCell() { - } + public UpdateCell() { + } - public String getServerId() { - return serverId; - } + public String getServerId() { + return serverId; + } - public void setServerId(String serverId) { - this.serverId = serverId; - } + public void setServerId(String serverId) { + this.serverId = serverId; + } - public String getIp() { - return ip; - } + public String getIp() { + return ip; + } - public void setIp(String ip) { - this.ip = ip; - } + public void setIp(String ip) { + this.ip = ip; + } - public String getNetconfPort() { - return netconfPort; - } + public String getNetconfPort() { + return netconfPort; + } - public void setNetconfPort(String netconfPort) { - this.netconfPort = netconfPort; - } + public void setNetconfPort(String netconfPort) { + this.netconfPort = netconfPort; + } - public Topology getOneCell() { - return oneCell; - } + public Topology getOneCell() { + return oneCell; + } - public void setOneCell(Topology oneCell) { - this.oneCell = oneCell; - } + public void setOneCell(Topology oneCell) { + this.oneCell = oneCell; + } - /** - * Update cell details based on input. - * - * @param serverId - * netconf server id - * @param ip - * ip address - * @param netconfPort - * port number - * @param oneCell - * topology details - */ - public UpdateCell(String serverId, String ip, String netconfPort, Topology oneCell) { - super(); - this.serverId = serverId; - this.ip = ip; - this.netconfPort = netconfPort; - this.oneCell = oneCell; - } + /** + * Update cell details based on input. + * + * @param serverId netconf server id + * @param ip ip address + * @param netconfPort port number + * @param oneCell topology details + */ + public UpdateCell(String serverId, String ip, String netconfPort, Topology oneCell) { + super(); + this.serverId = serverId; + this.ip = ip; + this.netconfPort = netconfPort; + this.oneCell = oneCell; + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/server/RansimWebSocketServer.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/server/RansimWebSocketServer.java index db94bfd..c58feeb 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/server/RansimWebSocketServer.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/server/RansimWebSocketServer.java @@ -32,191 +32,223 @@ import javax.websocket.server.ServerEndpoint; import javax.websocket.EncodeException; import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.controller.RansimController; +import org.onap.ransim.rest.api.services.RansimControllerServices; import org.onap.ransim.websocket.model.DeviceData; import org.onap.ransim.websocket.model.DeviceDataDecoder; import org.onap.ransim.websocket.model.DeviceDataEncoder; import org.onap.ransim.websocket.model.MessageTypes; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; -@ServerEndpoint(value = "/RansimAgent/{IpPort}", encoders = { DeviceDataEncoder.class }, decoders = { DeviceDataDecoder.class }) +@Controller +@ServerEndpoint(value = "/RansimAgent/{IpPort}", encoders = { DeviceDataEncoder.class }, decoders = { + DeviceDataDecoder.class }) public class RansimWebSocketServer { - - static Logger log = Logger.getLogger(RansimWebSocketServer.class.getName()); - - /** - * Set of actions to be done when connection is opened. - * - * @param session - * Session details - * @param ipPort - * ip address of the agent - */ - @OnOpen - public void onOpen(Session session, @PathParam("IpPort") String ipPort) { - log.info("WSS Ransim client(" + ipPort + ") opened a connection with id " + session.getId()); - try { - String serverId = RansimController.getRansimController().addWebSocketSessions(ipPort, - session); - if (serverId != null) { - log.info("New websocket session added for " + serverId); - RansimController.getRansimController().sendInitialConfigForNewAgent(ipPort, - serverId); - } else { - log.info("RansimWebSocketServer: No assigned ServerId found - No intial configuration sent to New Agent " - + ipPort); - } - } catch (Exception e) { - log.info("Exception in onOpen:", e); - } - } - - /* - @OnMessage - public void onMessage(String messageStr, Session session, @PathParam("IpPort") String ipPort) { - log.info("WSS Str Message received from client(" + ipPort + ") with id " + session.getId()); - try { - if (messageStr != null) { - DeviceData message = new DeviceDataDecoder().decode(messageStr); - if (message.getMessage() == null || message.getMessage().trim().equals("")) { - log.debug("Periodic ping message.... ignore"); - return; - } else { - - if (message.getType().equals(MessageTypes.HC_TO_RC_MODPCI)) { - RansimController.getRansimController().handleModifyPciFromSdnr( - message.getMessage(), session, ipPort); - } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { - RansimController.getRansimController().handleModifyNeighborFromSdnr( - message.getMessage(), session, ipPort); - } - } - } - } catch (Exception e) { - log.info("Exception in onMessage:", e); - } - } - */ - - - /** - * Handles the message sent from the agent. - * - * @param message - * message sent from the agent - * @param session - * session details - * @param ipPort - * ip address - * public void onMessage(DeviceData message, Session session, @PathParam("IpPort") String ipPort) { - */ - @OnMessage - public void onMessage(final DeviceData message, final Session session, @PathParam("IpPort") String ipPort) - throws IOException, EncodeException { - log.info("WSS Obj Message received from client(" + ipPort + ") with id " + session.getId()); - try { - if (message != null) { - if (message.getMessage() == null || message.getMessage().trim().equals("")) { - log.debug("Periodic ping message.... ignore"); - return; - } else { - - if (message.getType().equals(MessageTypes.HC_TO_RC_MODPCI)) { - log.info("Modify pci message received"); - RansimController.getRansimController().handleModifyPciFromSdnr( - message.getMessage(), session, ipPort); - } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { - log.info("Modify anr message received"); - RansimController.getRansimController().handleModifyNeighborFromSdnr( - message.getMessage(), session, ipPort); - } - } - } - } catch (Exception e) { - log.info("Exception in onMessage:", e); - } - } - - /** - * Set of actions to be done when connection is closed. - * - * @param reason - * reason the session was closed - * @param session - * session details - * @param ipPort - * ip address - */ - @OnClose - public void onClose(CloseReason reason, Session session, @PathParam("IpPort") String ipPort) { - try { - log.info("WSS Closing client(" + ipPort + ") cxn with id " + session.getId() + "due to " + reason.getReasonPhrase()); - RansimController.getRansimController().removeWebSocketSessions(ipPort); - } catch (Exception e) { - log.info("Exception in onClose:", e); - } - } - - public static void sendUpdateCellMessage(String str, Session session) { - DeviceData data = new DeviceData(); - data.setType(MessageTypes.RC_TO_HC_UPDCELL); - data.setMessage(str); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void sendPmMessage(String str, Session session) { - DeviceData data = new DeviceData(); - data.setType(MessageTypes.RC_TO_HC_PMDATA); - data.setMessage(str); - log.info("data.setMessage: " + data.getMessage()); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void sendFmMessage(String str, Session session) { - DeviceData data = new DeviceData(); - data.setType(MessageTypes.RC_TO_HC_FMDATA); - data.setMessage(str); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void sendSetConfigTopologyMessage(String str, Session session) { - DeviceData data = new DeviceData(); - data.setType(MessageTypes.RC_TO_HC_SETCONFIGTOPO); + + static Logger log = Logger.getLogger(RansimWebSocketServer.class.getName()); + + private static RansimControllerServices rscServices; + + @Autowired + public void setRscServices(RansimControllerServices service){ + this.rscServices=service; + } + /** + * Set of actions to be done when connection is opened. + * + * @param session Session details + * @param ipPort ip address of the agent + */ + @OnOpen + public void onOpen(Session session, @PathParam("IpPort") String ipPort) { + try { + String useCaseType = RansimControllerServices.useCaseType; + switch(useCaseType) { + case "sonUsecase": + log.info("RansimWebSocketServer : Assign serverId wrt SlicingUsecase"); + String serverId = rscServices.addWebSocketSessions(ipPort, session); + if (serverId != null) { + log.info("New websocket session added for " + serverId); + rscServices.sendInitialConfigForNewAgent(ipPort, serverId); + } else { + log.info("RansimWebSocketServer: No assigned ServerId found - No intial configuration sent to New Agent " + ipPort); + } + break; + case "ranSlicingUsecase": + log.info("RansimWebSocketServer : Assign serverId wrt RANSlicingUsecase"); + String ranServerId = rscServices.addRanWebSocketSessions(ipPort, session); + if (ranServerId != null) { + log.info("New websocket session added for " + ranServerId); + rscServices.sendRanInitialConfigForNewAgent(ipPort, ranServerId); + } else { + log.info("RansimWebSocketServer: No assigned ServerId found - No intial configuration sent to New Agent " + ipPort); + } + break; + default: + log.info("RansimWebSocketServer: No assigned ServerId found"); + } + } catch (Exception e) { + log.info("Exception in onOpen:", e); + } + } + + /** + * Handles the message sent from the agent. + * + * @param message message sent from the agent + * @param session session details + * @param ipPort ip address public void onMessage(DeviceData message, Session + * session, @PathParam("IpPort") String ipPort) { + */ + @OnMessage + public void onMessage(final DeviceData message, final Session session, @PathParam("IpPort") String ipPort) + throws IOException, EncodeException { + log.info("WSS Obj Message received from client(" + ipPort + ") with id " + session.getId()); + try { + if (message != null) { + if (message.getMessage() == null || message.getMessage().trim().equals("")) { + log.debug("Periodic ping message.... ignore"); + return; + } else { + + if (message.getType().equals(MessageTypes.HC_TO_RC_MODPCI)) { + log.info("Modify pci message received"); + rscServices.handleModifyPciFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { + log.info("Modify anr message received"); + rscServices.handleModifyNeighborFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_RTRIC)) { + log.info("Distribute RTRIC Config message received"); + rscServices.handleRTRICConfigFromSdnr(message.getMessage(), session, ipPort); + } else if(message.getType().equals(MessageTypes.HC_TO_RC_RRM_POLICY)){ + log.info("Add RRMPolicyRatio message received"); + rscServices.handleRRMPolicyRatioUpdateFromSdnr(message.getMessage(), session, ipPort); + } else if(message.getType().equals(MessageTypes.HC_TO_RC_PLMN)){ + log.info("Add PLMNInfo message received"); + rscServices.handlePLMNInfoUpdateFromSdnr(message.getMessage(), session, ipPort); + } else if(message.getType().equals(MessageTypes.HC_TO_RC_SLICE_PROFILE)){ + log.info("Add SliceProfile message received"); + rscServices.handleSliceProfileUpdateFromSdnr(message.getMessage(), session, ipPort); + } else if(message.getType().equals(MessageTypes.HC_TO_RC_RRM_POLICY_DEL)){ + log.info("Delete RRMPolicyRatio message received"); + rscServices.handleRRMPolicyRatioDeleteFromSdnr(message.getMessage(), session, ipPort); + } else if(message.getType().equals(MessageTypes.HC_TO_RC_PLMN_DEL)){ + log.info("Delete PLMNInfo message received"); + rscServices.handlePLMNInfoDeleteFromSdnr(message.getMessage(), session, ipPort); + } else if(message.getType().equals(MessageTypes.HC_TO_RC_SLICE_PROFILE_DEL)){ + log.info("Delete SliceProfile message received"); + rscServices.handleSliceProfileDeleteFromSdnr(message.getMessage(), session, ipPort); + } + + } + } + } catch (Exception e) { + log.info("Exception in onMessage:", e); + } + } + + /** + * Set of actions to be done when connection is closed. + * + * @param reason reason the session was closed + * @param session session details + * @param ipPort ip address + */ + @OnClose + public void onClose(CloseReason reason, Session session, @PathParam("IpPort") String ipPort) { + try { + log.info("WSS Closing client(" + ipPort + ") cxn with id " + session.getId() + "due to " + + reason.getReasonPhrase()); + rscServices.removeWebSocketSessions(ipPort); + } catch (Exception e) { + log.info("Exception in onClose:", e); + } + } + + public static void sendUpdateCellMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_UPDCELL); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendPmMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_PMDATA); + data.setMessage(str); + log.info("data.setMessage: " + data.getMessage()); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendIntelligentSlicingPmData(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_PMFILEDATA); data.setMessage(str); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void sendPingMessage(Session session) { - DeviceData data = new DeviceData(); - data.setType(MessageTypes.RC_TO_HC_PING); - data.setMessage(""); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static void sendMessage(DeviceData data, Session session) { - try { - session.getBasicRemote().sendObject(data); - } catch (Exception e) { - log.info("Exception in sendMessage:", e); - } - } + log.info("data.setMessage: " + data.getMessage()); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendFmMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_FMDATA); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendSetConfigTopologyMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_SETCONFIGTOPO); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendSetReconfigureMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.HC_TO_RC_RTRIC); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendPingMessage(Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_PING); + data.setMessage(""); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void sendMessage(DeviceData data, Session session) { + try { + session.getBasicRemote().sendObject(data); + } catch (Exception e) { + log.info("Exception in sendMessage:", e); + } + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/META-INF/persistence.xml b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index bbfb0f3..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - org.eclipse.persistence.jpa.PersistenceProvider - org.onap.ransim.rest.api.models.CellDetails - org.onap.ransim.rest.api.models.CellNeighbor - org.onap.ransim.rest.api.models.NetconfServers - org.onap.ransim.rest.api.models.OperationLog - org.onap.ransim.rest.api.models.NeighborDetails - - - - - - - - - - - - diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties new file mode 100644 index 0000000..02a81ec --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties @@ -0,0 +1,8 @@ +spring.datasource.username=root +spring.datasource.password=secret +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.jpa.hibernate.ddl-auto=update +spring.datasource.url=jdbc:mariadb://mariadb:3306/ransim_db +hibernate.dialect=org.hibernate.dialect.MariaDBDialect +spring.config.location=/tmp/ransim-install/config/ +spring.config.name=ransim diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/dumpfileNames.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/dumpfileNames.properties new file mode 100644 index 0000000..4f9be36 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/dumpfileNames.properties @@ -0,0 +1 @@ +defaultFiles=latestDump.json,1050cells.json,sample.json \ No newline at end of file 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 ff88afa..89cfb86 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 @@ -32,26 +32,26 @@ import java.util.Set; import mockit.Mock; import mockit.MockUp; - import org.junit.Test; import org.junit.runner.RunWith; -//import org.mockito.Mock; import org.mockito.Mockito; +import static org.mockito.Mockito.when; import org.mockito.runners.MockitoJUnitRunner; import org.onap.ransim.rest.api.models.CellDetails; import org.onap.ransim.rest.api.models.CellNeighbor; 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.NeihborId; import org.onap.ransim.rest.api.models.NetconfServers; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RansimRepositoryService; import org.onap.ransim.rest.client.RestClient; import org.onap.ransim.websocket.model.CommonEventHeaderFm; import org.onap.ransim.websocket.model.EventFm; import org.onap.ransim.websocket.model.FaultFields; import org.springframework.context.annotation.PropertySource; - -import com.google.gson.Gson; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; /** * @author ubuntu16 @@ -60,17 +60,17 @@ import com.google.gson.Gson; @RunWith(MockitoJUnitRunner.class) @PropertySource("classpath:ransim.properties") public class TestRansimController { + @Test public void testGetRansimController() { - - RansimController rc = RansimController.getRansimController(); - assertNotNull(rc); - } - + RansimControllerServices rc = Mockito.mock(RansimControllerServices.class); + assertNotNull(rc); + } + @Test public void testsetNetconfServers() { // fail("Not yet implemented"); - RansimController rscontroller = Mockito.mock(RansimController.class); + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); CellDetails cell1 = new CellDetails("Chn01", 1, "nc1"); CellDetails cell2 = new CellDetails("Chn02", 2, "nc1"); CellDetails cell3 = new CellDetails("Chn03", 3, "nc1"); @@ -80,24 +80,25 @@ public class TestRansimController { cells.add(cell1); cells.add(cell2); cells.add(cell3); + cells.add(cell4); NetconfServers server = new NetconfServers("nc1", null, null, cells); - new MockUp() { + new MockUp() { @Mock NetconfServers getNetconfServer(String serverId) { return server; } }; - new MockUp() { + new MockUp() { @Mock CellDetails getCellDetail(String nodeId) { return cell4; } }; - new MockUp() { + new MockUp() { @Mock void mergeNetconfServers(NetconfServers netconfServers) { @@ -115,7 +116,7 @@ public class TestRansimController { @Test public void testGenerateNeighborList() { // fail("Not yet implemented"); - RansimController rscontroller = Mockito.mock(RansimController.class); + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); Set neighborList = new HashSet(); NeighborDetails nbr1 = new NeighborDetails(new NeihborId("Chn00", "Chn01"), false); NeighborDetails nbr2 = new NeighborDetails(new NeihborId("Chn00", "Chn02"), false); @@ -134,7 +135,7 @@ public class TestRansimController { cellNbr.setNodeId("Chn00"); cellNbr.setNeighborList(neighborList); - new MockUp() { + new MockUp() { @Mock CellNeighbor getCellNeighbor(String nodeId) { if (nodeId.equals("Chn00")) { @@ -146,7 +147,7 @@ public class TestRansimController { } }; - new MockUp() { + new MockUp() { @Mock CellDetails getCellDetail(String nodeId) { if (nodeId.equals("Chn00")) { @@ -181,7 +182,7 @@ public class TestRansimController { @Test public void testSetEventFm() { // fail("Not yet implemented"); - RansimController rscontroller = Mockito.mock(RansimController.class); + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); Map alarmAdditionalInformation = new HashMap(); alarmAdditionalInformation.put("networkId", "abc"); alarmAdditionalInformation.put("collisions", "1"); @@ -191,7 +192,7 @@ public class TestRansimController { alarmAdditionalInformation); EventFm checkObj = new EventFm(commonEventHeader, faultFields); - new MockUp() { + new MockUp() { @Mock String getUuid() { return ""; @@ -230,9 +231,9 @@ public class TestRansimController { //@Test public void testStopAllCells() { - RansimController rscontroller = Mockito.mock(RansimController.class); + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); - new MockUp() { + new MockUp() { @Mock List getNetconfServersList() { System.out.println("getNetconfServersList"); @@ -254,9 +255,58 @@ public class TestRansimController { } }; - String result = rscontroller.stopAllCells(); + String result = rscontroller.stopAllSimulation(); System.out.println("testStopAllCells: " + result); assertEquals("Netconf servers unmounted.", result); } -} \ No newline at end of file + @Test + public void testStartRanSimulation() throws Exception { + + ResponseEntity rsEntity = new ResponseEntity<>("Simulation started", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.startRanSliceSimulation()).thenReturn(rsEntity); + assertEquals(rscontroller.startRanSliceSimulation(), rsEntity); + + } + + @Test + public void testFailureStartRanSimulation() throws Exception { + + RansimController rscontroller = new RansimController(); + ResponseEntity result = rscontroller.startRanSliceSimulation(); + assertEquals(result.getStatusCode(), HttpStatus.INTERNAL_SERVER_ERROR); + + } + + @Test + public void testStopRanSimulation() throws Exception { + + ResponseEntity rsEntity = new ResponseEntity<>("Simulation stopped", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.stopRanSliceSimulation()).thenReturn(rsEntity); + assertEquals(rscontroller.stopRanSliceSimulation(), rsEntity); + + } + + @Test + public void testGenerateIntelligentSlicingPmData() throws Exception { + + ResponseEntity rsEntity = new ResponseEntity<>("IntelligentSlicing PM data generated", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.generateIntelligentSlicingPmData()).thenReturn(rsEntity); + assertEquals(rscontroller.generateIntelligentSlicingPmData(), rsEntity); + + } + + @Test + public void testStopIntelligentSlicingPmData() throws Exception { + + ResponseEntity rsEntity = new ResponseEntity<>("Stopped PM data generation.", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.stopIntelligentSlicingPmData()).thenReturn(rsEntity); + assertEquals(rscontroller.stopIntelligentSlicingPmData(), rsEntity); + + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/services/TestRANSliceConfigServices.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/services/TestRANSliceConfigServices.java new file mode 100644 index 0000000..91c348c --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/services/TestRANSliceConfigServices.java @@ -0,0 +1,316 @@ +package org.onap.ransim.rest.api.services; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +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.NRCellDUModel; +import org.onap.ransim.rest.web.mapper.NearRTRICModel; +import org.onap.ransim.rest.web.mapper.RANSliceInfoModel; +import org.springframework.context.annotation.PropertySource; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +@PropertySource("classpath:ransim.properties") +public class TestRANSliceConfigServices { + + @Mock + RANSliceConfigService rANSliceConfigService; + + ObjectMapper objectMapper = new ObjectMapper(); + + @Test + public void testSaveGNBCUCP() { + String input = "{\"gNBCUName\":\"cucpserver1\",\"gNBId\":98763,\"gNBIdLength\":5,\"pLMNId\":\"310-410\",\"nFType\":\"CUCP\",\"nearRTRICId\":11,\"cellCUList\":[{\"cellLocalId\":103594000,\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-093\",\"status\":\"ACTIVE\",\"configData\":{\"maxNumberOfConns\":3000}}}]}]}"; + GNBCUCPModel gNBCUCPModel = new GNBCUCPModel(); + try { + gNBCUCPModel = objectMapper.readValue(input, GNBCUCPModel.class); + }catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + Mockito.doReturn(gNBCUCPModel).when(rANSliceConfigService).saveGNBCUCP(gNBCUCPModel); + assertEquals(gNBCUCPModel, rANSliceConfigService.saveGNBCUCP(gNBCUCPModel)); + } + + @Test + public void testFetchGNBCUCPData() { + String cuCPName = "cucpserver1"; + GNBCUCPModel gNBCUCPModel = new GNBCUCPModel(); + Mockito.doReturn(gNBCUCPModel).when(rANSliceConfigService).fetchGNBCUCPData(cuCPName); + assertEquals(gNBCUCPModel, rANSliceConfigService.fetchGNBCUCPData(cuCPName)); + } + + @Test + public void testSaveGNBDU() { + String input="{\"gNBDUId\":1,\"gNBId\":98763,\"gNBIdLength\":5,\"pLMNId\":\"310-410\",\"gNBDUName\":\"gnduserver1\",\"nFType\":\"DU\",\"nearRTRICId\":11,\"cellDUList\":[{\"cellLocalId\":103593999,\"operationalState\":\"ENABLED\",\"administrativeState\":\"UNLOCKED\",\"cellState\":\"ACTIVE\",\"nRPCI\":12,\"nRTAC\":310,\"resourceType\":\"PRB\",\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":50,\"uLThptPerSlice\":40}}}]}]}"; + GNBDUModel gNBDUModel = new GNBDUModel(); + try { + gNBDUModel = objectMapper.readValue(input, GNBDUModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(gNBDUModel).when(rANSliceConfigService).saveGNBDU(gNBDUModel); + assertEquals(gNBDUModel, rANSliceConfigService.saveGNBDU(gNBDUModel)); + } + + @Test + public void testFetchGNBDUData() { + int gNBDUId=1; + GNBDUModel gNBDUModel = new GNBDUModel(); + Mockito.doReturn(gNBDUModel).when(rANSliceConfigService).fetchGNBDUData(gNBDUId); + assertEquals(gNBDUModel, rANSliceConfigService.fetchGNBDUData(gNBDUId)); + } + + @Test + public void testSaveGNBCUUP() { + String input = "{\"gNBCUUPId\":1111,\"gNBId\":98763,\"gNBIdLength\":2,\"resourceType\":\"DRB\",\"nearRTRICId\":11,\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"maxNumberOfConns\":3000}}}]}"; + GNBCUUPModel gNBCUUPModel = new GNBCUUPModel(); + try { + gNBCUUPModel=objectMapper.readValue(input, GNBCUUPModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(gNBCUUPModel).when(rANSliceConfigService).saveGNBCUUP(gNBCUUPModel); + assertEquals(gNBCUUPModel, rANSliceConfigService.saveGNBCUUP(gNBCUUPModel)); + } + + @Test + public void testFetchGNBCUUPData() { + Integer gNBCUUPId = 1111; + String response = "{\"gNBCUUPId\":1111,\"gNBId\":98763,\"gNBIdLength\":2,\"resourceType\":\"DRB\",\"nearRTRICId\":11,\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"maxNumberOfConns\":3000}}}]}"; + GNBCUUPModel gNBCUUPModel = new GNBCUUPModel(); + try { + gNBCUUPModel=objectMapper.readValue(response, GNBCUUPModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(gNBCUUPModel).when(rANSliceConfigService).fetchGNBCUUPData(gNBCUUPId); + assertEquals(gNBCUUPModel, rANSliceConfigService.fetchGNBCUUPData(gNBCUUPId)); + + } + + @Test + public void testSaveNearRTRIC() { + NearRTRICModel nearRTRIC = new NearRTRICModel(); + String input = "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + try { + nearRTRIC=objectMapper.readValue(input, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(nearRTRIC).when(rANSliceConfigService).saveNearRTRIC(nearRTRIC); + assertEquals(nearRTRIC, rANSliceConfigService.saveNearRTRIC(nearRTRIC)); + } + + @Test + public void testFetchNearRTRICData() { + int nearRTRICId = 11; + String response = "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC=objectMapper.readValue(response, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(nearRTRIC).when(rANSliceConfigService).fetchNearRTRICData(nearRTRICId); + assertEquals(nearRTRIC, rANSliceConfigService.fetchNearRTRICData(nearRTRICId)); + } + + @Test + public void testFindRICsInTA() { + String nSSAI="01-000100"; + List ricsList = new ArrayList<>(); + String ricModel = "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC=objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findRICsInTA(Mockito.anyString()); + assertEquals(ricsList, rANSliceConfigService.findRICsInTA(nSSAI)); + } + + @Test + public void testfindNearRTRICofCells() { + List cellIds=new ArrayList();cellIds.add(23456);cellIds.add(45785); + List ricsList = new ArrayList<>(); + String ricModel = "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC=objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findNearRTRICofCells(Mockito.anyList()); + assertEquals(ricsList, rANSliceConfigService.findNearRTRICofCells(cellIds)); + } + + @Test + public void testUpdateRANInventory() { + String input = "{\"ranNFNSSIId\":\"11\",\"ranNSSIList\":[\"ran3\"],\"nSSAIList\":[\"001-003\",\"001-001\"],\"sliceProfilesList\":[{\"sliceProfileId\":12,\"dLThptPerSlice\":1,\"uLThptPerSlice\":2,\"maxNumberofConns\":3,\"sNSSAI\":\"001-003\"}],\"trackingAreaList\":\"Chennai\",\"subnetStatus\":\"ACTIVE\",\"nsstId\":\"NSSTID1\",\"sliceType\":\"eMBB\",\"isShareable\":\"true\"}"; + RANSliceInfoModel inventorynfo = new RANSliceInfoModel(); + try { + inventorynfo=objectMapper.readValue(input, RANSliceInfoModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(inventorynfo).when(rANSliceConfigService).updateRANInventory(Mockito.anyObject()); + assertEquals(inventorynfo, rANSliceConfigService.updateRANInventory(inventorynfo)); + } + + @Test + public void testFetchRANSlice() { + String ranNFNSSIId="11"; + String input = "{\"ranNFNSSIId\":\"11\",\"ranNSSIList\":[\"ran3\"],\"nSSAIList\":[\"001-003\",\"001-001\"],\"sliceProfilesList\":[{\"sliceProfileId\":12,\"dLThptPerSlice\":1,\"uLThptPerSlice\":2,\"maxNumberofConns\":3,\"sNSSAI\":\"001-003\"}],\"trackingAreaList\":\"Chennai\",\"subnetStatus\":\"ACTIVE\",\"nsstId\":\"NSSTID1\",\"sliceType\":\"eMBB\",\"isShareable\":\"true\"}"; + RANSliceInfoModel inventorynfo = new RANSliceInfoModel(); + try { + inventorynfo=objectMapper.readValue(input, RANSliceInfoModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(inventorynfo).when(rANSliceConfigService).fetchRANSlice(ranNFNSSIId); + assertEquals(inventorynfo, rANSliceConfigService.fetchRANSlice(ranNFNSSIId)); + } + + @Test + public void testFetchCellsofTA() { + String trackingArea = "Kingston"; + List cellIds=new ArrayList();cellIds.add("23456");cellIds.add("45785"); + Mockito.doReturn(cellIds).when(rANSliceConfigService).fetchCellsofTA(Mockito.anyString()); + assertEquals(cellIds, rANSliceConfigService.fetchCellsofTA(trackingArea)); + } + + @Test + public void testFetchCUCellsofRIC() { + Integer nearRTRICId=1; + List cellCUList= new ArrayList<>(); + Mockito.doReturn(cellCUList).when(rANSliceConfigService).fetchCUCellsofRIC(Mockito.anyInt()); + assertEquals(cellCUList, rANSliceConfigService.fetchCUCellsofRIC(nearRTRICId));; + } + + @Test + public void testFetchDUCellsofRIC() { + String sNSSAI = "001-00001"; + Map> cellsMap = new HashMap>(); + Mockito.doReturn(cellsMap).when(rANSliceConfigService).fetchDUCellsofRIC(Mockito.anyString()); + assertEquals(cellsMap, rANSliceConfigService.fetchDUCellsofRIC(sNSSAI));; + } + + @Test + public void testFindNearRTRICByNSSI() { + String ranNFNSSIID="11"; + List ricsList = new ArrayList<>(); + String ricModel = "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC=objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findNearRTRICByNSSI(Mockito.anyString()); + assertEquals(ricsList, rANSliceConfigService.findNearRTRICByNSSI(ranNFNSSIID)); + } + + @Test + public void testFindRICsByNSSAI() { + String sNSSAI = "001-00001"; + List ricsList = new ArrayList<>(); + String ricModel = "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC=objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findRICsByNSSAI(Mockito.anyString()); + assertEquals(ricsList, rANSliceConfigService.findRICsByNSSAI(sNSSAI)); + } + + @Test + public void testFindSliceProfileconfig() { + String sNSSAI = "001-00001"; + Map configDetails = new HashMap(); + configDetails.put("dLThptPerSlice",40); + configDetails.put("uLThptPerSlice",50); + Mockito.doReturn(configDetails).when(rANSliceConfigService).findSliceProfileconfig(Mockito.anyString()); + assertEquals(configDetails, rANSliceConfigService.findSliceProfileconfig(sNSSAI)); + } + @Test + public void testFindSliceeconfig() { + String sNSSAI = "001-00001";Map configMap = new HashMap(); + Mockito.doReturn(configMap).when(rANSliceConfigService).findSliceConfig(Mockito.anyString()); + assertEquals(configMap, rANSliceConfigService.findSliceConfig(sNSSAI)); + } + + @Test + public void testFindDUsofSNssai() { + String sNSSAI = "001-00001"; + List duModels = new ArrayList(); + Mockito.doReturn(duModels).when(rANSliceConfigService).findDUsofSNssai(Mockito.anyString()); + assertEquals(duModels, rANSliceConfigService.findDUsofSNssai(sNSSAI)); + } + + @Test + public void testFindCUsofSNssai() { + String sNSSAI = "001-00001"; + List cuModels = new ArrayList(); + Mockito.doReturn(cuModels).when(rANSliceConfigService).findCUsofSNssai(Mockito.anyString()); + assertEquals(cuModels, rANSliceConfigService.findCUsofSNssai(sNSSAI)); + } + + @Test + public void testGetSubscriberDetails() { + String sNSSAI = "001-00001"; + Map details = new HashMap(); + Mockito.doReturn(details).when(rANSliceConfigService).getSubscriberDetails(Mockito.anyString()); + assertEquals(details, rANSliceConfigService.getSubscriberDetails(sNSSAI)); + } + + @Test + public void testFindAllCUCPFunctions() { + List cucpModels = new ArrayList(); + Mockito.doReturn(cucpModels).when(rANSliceConfigService).findAllCUCPFunctions(); + assertEquals(cucpModels, rANSliceConfigService.findAllCUCPFunctions()); + } + + @Test + public void testFindAllDUFunctions() { + List duModels = new ArrayList(); + Mockito.doReturn(duModels).when(rANSliceConfigService).findAllDUFunctions(); + assertEquals(duModels, rANSliceConfigService.findAllDUFunctions()); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/resources/hibernate.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/resources/hibernate.properties index 7d6e456..9b7d955 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/resources/hibernate.properties +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/resources/hibernate.properties @@ -1,5 +1,13 @@ +# +# Hibernate, Relational Persistence for Idiomatic Java +# +# License: GNU Lesser General Public License (LGPL), version 2.1 or later. +# See the lgpl.txt file in the root directory or . +# + hibernate.dialect org.hibernate.dialect.H2Dialect hibernate.connection.driver_class org.h2.Driver +#hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1 hibernate.connection.username sa @@ -13,8 +21,9 @@ hibernate.max_fetch_depth 5 hibernate.cache.region_prefix hibernate.test hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory +# NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle hibernate.jdbc.batch_versioned_data true javax.persistence.validation.mode=NONE hibernate.service.allow_crawling=false -hibernate.session.events.log=true +hibernate.session.events.log=true \ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html index aba0ad6..ec9bc60 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html @@ -21,7 +21,7 @@ -Cell Operations History +Netconf server details - - -
-

Simulator Configuration

-
-
- - - - - - - -
- Do you really want to stop the Simulation and clear the Simulated data? -
- - -
-
-
- + + + +
+

Simulator Configuration

+
+
+ + + + + + + +
Do you really want to stop the Simulation and clear the + Simulated data?
+ + +
+
+
+ -
+ +
+ diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html index 1193a7c..6fb1299 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html @@ -20,66 +20,76 @@ --> - - Simulator Configuration - - - -
-

Simulator Configuration

-
-
- - - - - - - - - - - - - -
Cluster Level:: -
- Cluster Level is mandatory. - -
Grid Size: -
- Grid Size is mandatory. - -
No. of Clusters: -
- No. of Clusters is mandatory. - -
- -
-
-
Click view to check details of the updated cells
+ +

+ +

+
Click view to check + details of the updated cells
-
-
+

-
-
+

PM data
-
-
- +

-

- - +

+ + - +Delete Cell Configuration + + -
-

Delete Cell Configuration

-
-
- - - - - - - -
- Do you really want to delete the Cell {{nodeId}}? -
- - -
-
-
- -
+
diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html index 9c8ab7b..9e52eb2 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html @@ -20,82 +20,57 @@ --> - - Display Cell Details - - - -
-

Cell Details

-
-
- - - - - - - - - - - - - - - - - -
Node Id: -
- Node Id is mandatory. - -
Physical Cell Id: -
-
Pnf Name: -
-
-
-
- + + + +
+

Cell Details

+
+
+ + + + + + + + + + + + + +
Node Id:
+ + Node Id + is mandatory. +
Physical Cell Id:
+
Pnf Name:
+
+
+ -
+ +
+ diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html index b878d65..86eae42 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html @@ -23,49 +23,59 @@ - - - - - + + - - -
-

Modify Cell Configuration

-
-
- - - - - - - - - - - - - - - - - - - -
Node Id: -
- Node Id is mandatory. - -
Physical Cell Id: -
-
Existing Neighbors: -
-
New Neighbors: -
-
-