diff options
10 files changed, 35 insertions, 35 deletions
diff --git a/ransim/docker/config/db/ransim_schema.sql b/ransim/docker/config/db/ransim_schema.sql index a155a8f..7b129fe 100644 --- a/ransim/docker/config/db/ransim_schema.sql +++ b/ransim/docker/config/db/ransim_schema.sql @@ -57,7 +57,7 @@ create table nearrtric ( -- ----------------------------------------------------- create table trackingarea ( nearrtricid integer not null, - tracking_area varchar(255) + tracking_area integer ) engine = InnoDB; -- ----------------------------------------------------- -- Table `ransim_db`.`rannfnssi` @@ -179,7 +179,7 @@ create table rrmpolicymember ( -- Table `ransim_db`.`tacells` -- ----------------------------------------------------- create table tacells ( - trackingarea varchar(255) not null, + trackingarea integer not null, cells varchar(255), primary key (trackingarea) ) engine = InnoDB; @@ -225,10 +225,10 @@ create table sliceprofile ( -- ----------------------------------------------------- -- 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'); +INSERT INTO tacells(trackingarea,cells) VALUES(101, '15289,15290,15296,15687,15689,15155,15174,15175'); +INSERT INTO tacells(trackingarea,cells) VALUES(202, '15176,15825,15826,15425,15426,13999,14000'); +INSERT INTO tacells(trackingarea,cells) VALUES(303, '11561,11562,11568,11569,10896,10897,14655,14656'); +INSERT INTO tacells(trackingarea,cells) VALUES(404, '13905,13910,15360,15361,15548,15549,14427'); --nearrtric INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(11, 98763, 'NearRTRIC'); 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 index b6a661d..0ce0431 100644 --- 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 @@ -271,7 +271,7 @@ public class RANSliceConfigController { * @return */ @GetMapping(path = "/nearrtric-list/{trackingArea}") - public ResponseEntity<List<NearRTRICModel>> findNearRTRICofCellsFromTA(@PathVariable String trackingArea) { + public ResponseEntity<List<NearRTRICModel>> findNearRTRICofCellsFromTA(@PathVariable int trackingArea) { logger.info("Request Received"); try { List<String> cellIds = this.findListOfCells(trackingArea).getBody(); @@ -296,7 +296,7 @@ public class RANSliceConfigController { * @return */ @GetMapping(path = "/cell-list/{trackingArea}") - public ResponseEntity<List<String>> findListOfCells(@PathVariable String trackingArea) { + public ResponseEntity<List<String>> findListOfCells(@PathVariable int trackingArea) { logger.info("Request Received"); try { if (ranSliceConfigService.fetchCellsofTA(trackingArea).size() > 0) { 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 5a26336..ddf2513 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 @@ -684,7 +684,7 @@ public class RansimController { try { long startTime = (System.currentTimeMillis()); Iterable<TACells> tacellList = ranSliceConfigService.fetchAllTA(); - HashMap<String, List<String>> taCells = new HashMap<>(); + HashMap<Integer, List<String>> taCells = new HashMap<>(); for (TACells ta : tacellList) { String[] cells = ta.getCellsList().split(","); List<String> cellList = new ArrayList<String>(Arrays.asList(cells)); 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 index 4629fc6..43e80d6 100644 --- 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 @@ -69,7 +69,7 @@ public class RansimSlicingHandler { @Autowired RANSliceConfigService ranSliceConfigService; - public List<String> generateIntelligentSlicingPmData(long startTime, HashMap<String, List<String>> taCells) { + public List<String> generateIntelligentSlicingPmData(long startTime, HashMap<Integer, List<String>> taCells) { List<String> result = new ArrayList<String>(); try { String requestUrl = "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/cucp-list"; @@ -131,13 +131,13 @@ public class RansimSlicingHandler { configData = pLMNInfoModel.getsNSSAI().getConfigData().getMaxNumberOfConns(); noOfRequestedSessions = 0; successfulSessions = 0; - for (java.util.Map.Entry<String, List<String>> taCellMap : taCells.entrySet()) { + for (java.util.Map.Entry<Integer, List<String>> 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")) { + if (taCellMap.getKey()==101 + || taCellMap.getKey()==303) { rNumForTotalReq = 1.4 + (new Random().nextDouble() * (1.0 - 1.4)); } else { rNumForTotalReq = 0.6 + (new Random().nextDouble() * (0.3 - 0.6)); 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 index 5a716e9..961e048 100644 --- 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 @@ -42,9 +42,9 @@ public class NearRTRIC implements Serializable { private Integer nearRTRICId; @Column(name = "GNBID") private Integer gNBId; - @ElementCollection(targetClass = String.class) + @ElementCollection//(targetClass = String.class) @CollectionTable(name = "TRACKINGAREA", joinColumns = @JoinColumn(name = "nearrtricid")) - private List<String> trackingArea; + private List<Integer> trackingArea; @Column(name = "RESOURCETYPE") private String resourceType; @OneToMany(mappedBy = "nearRTRIC", cascade = CascadeType.ALL) @@ -76,11 +76,11 @@ public class NearRTRIC implements Serializable { this.gNBId = gNBId; } - public List<String> getTrackingArea() { + public List<Integer> getTrackingArea() { return trackingArea; } - public void setTrackingArea(List<String> trackingArea) { + public void setTrackingArea(List<Integer> trackingArea) { this.trackingArea = trackingArea; } 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 index 40ab024..bc60abb 100644 --- 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 @@ -33,15 +33,15 @@ public class TACells implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "TRACKINGAREA") - private String trackingArea; + private int trackingArea; @Column(name = "CELLS") private String cellsList; - public String getTrackingArea() { + public int getTrackingArea() { return trackingArea; } - public void setTrackingArea(String trackingArea) { + public void setTrackingArea(int trackingArea) { this.trackingArea = trackingArea; } 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 index 8ed4882..a2a184f 100644 --- 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 @@ -32,7 +32,7 @@ import org.springframework.stereotype.Repository; public interface NearRTRICRepository extends CrudRepository<NearRTRIC, Integer> { @Query(nativeQuery = true, value = "select * from nearrtric ric join trackingarea ta where tracking_area=?1") - public List<NearRTRIC> getListOfRICsInTrackingArea(String trackingArea); + public List<NearRTRIC> getListOfRICsInTrackingArea(int trackingArea); @Query(nativeQuery = true, value = "select * from nearrtric ric join gnbcucpfunction cucp where cucp.gnbcuname=?1") public List<NearRTRIC> findNearRTRICByCUCPName(String cucpNames); 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 index 92ccd1a..0feeb5d 100644 --- 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 @@ -30,6 +30,6 @@ import org.springframework.stereotype.Repository; * */ @Repository -public interface TACellRepository extends CrudRepository<TACells, String> { +public interface TACellRepository extends CrudRepository<TACells, Integer> { } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java index 7e2172b..36bd48a 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 @@ -330,7 +330,7 @@ public class RANSliceConfigService { * @param trackingArea * @return List<NearRTRICModel> */ - public List<NearRTRICModel> findRICsInTA(String trackingArea) { + public List<NearRTRICModel> findRICsInTA(int trackingArea) { logger.debug("Request received to find the NearRTRICs in Tracking Area::" + trackingArea); modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); List<NearRTRIC> nearRTRICsList = nearRTRICRepository.getListOfRICsInTrackingArea(trackingArea); @@ -411,7 +411,7 @@ public class RANSliceConfigService { * @param trackingArea * @return List<String> */ - public List<String> fetchCellsofTA(String trackingArea) { + public List<String> fetchCellsofTA(int trackingArea) { logger.debug("Request recieved to fetch the cell details of TA:" + trackingArea); modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); String cells = tACellRepository.findById(trackingArea).isPresent() 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 index 3ffea5b..70d3eed 100644 --- 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 @@ -137,7 +137,7 @@ public class TestRANSliceConfigServices { 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}}}]}"; + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":101,\"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) { @@ -152,7 +152,7 @@ public class TestRANSliceConfigServices { 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}}}]}"; + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":101,\"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); @@ -166,10 +166,10 @@ public class TestRANSliceConfigServices { @Test public void testFindRICsInTA() { - String nSSAI = "01-000100"; + int trackingArea = 101; List<NearRTRICModel> 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}}}]}"; + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":101,\"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); @@ -178,8 +178,8 @@ public class TestRANSliceConfigServices { e.printStackTrace(); } ricsList.add(nearRTRIC); - Mockito.doReturn(ricsList).when(rANSliceConfigService).findRICsInTA(Mockito.anyString()); - assertEquals(ricsList, rANSliceConfigService.findRICsInTA(nSSAI)); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findRICsInTA(Mockito.anyInt()); + assertEquals(ricsList, rANSliceConfigService.findRICsInTA(trackingArea)); } @Test @@ -189,7 +189,7 @@ public class TestRANSliceConfigServices { cellIds.add(45785); List<NearRTRICModel> 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}}}]}"; + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":101,\"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); @@ -235,11 +235,11 @@ public class TestRANSliceConfigServices { @Test public void testFetchCellsofTA() { - String trackingArea = "Kingston"; + int trackingArea = 202; List<String> cellIds = new ArrayList<String>(); cellIds.add("23456"); cellIds.add("45785"); - Mockito.doReturn(cellIds).when(rANSliceConfigService).fetchCellsofTA(Mockito.anyString()); + Mockito.doReturn(cellIds).when(rANSliceConfigService).fetchCellsofTA(Mockito.anyInt()); assertEquals(cellIds, rANSliceConfigService.fetchCellsofTA(trackingArea)); } @@ -264,7 +264,7 @@ public class TestRANSliceConfigServices { String ranNFNSSIID = "11"; List<NearRTRICModel> 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}}}]}"; + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":101,\"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); @@ -282,7 +282,7 @@ public class TestRANSliceConfigServices { String sNSSAI = "001-00001"; List<NearRTRICModel> 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}}}]}"; + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":101,\"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); |