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