diff options
author | yashwanth <gandhapu.yashwanth@wipro.com> | 2021-04-25 23:42:58 -0700 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2021-04-27 14:23:04 +0000 |
commit | e6194765959c1c2152b0392b2bbbd81c83db3329 (patch) | |
tree | 8ef0c2f79bdd35a6201f1340258116b053f6d026 /ransim/ransimctrlr/RANSIM-CTRLR/src | |
parent | 9764b6bb545a8edd4979c481627c38c1892f207e (diff) |
TrackingArea Type changehonolulu
Issue-ID: INT-1913
Signed-off-by: yashwanth <gandhapu.yashwanth@wipro.com>
Change-Id: Iba23a9dcee04a1c8604f88e7cc3bae795a9410ff
(cherry picked from commit 959c9cf80775c4b1e5d78f299a441ce9fe9bd9d3)
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-CTRLR/src')
9 files changed, 29 insertions, 29 deletions
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); |