aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiranjana <niranjana.y60@wipro.com>2022-05-11 10:42:22 +0000
committerNiranjana <niranjana.y60@wipro.com>2022-05-11 10:42:22 +0000
commited00244644b2d66d8388514a63ec053bfb1b0f82 (patch)
tree5bc2941f02602fc5184a25d7e508a00fc39a96a1
parent762d3059b5c881b2c961e14683738832536fe846 (diff)
Fix plmn-info update bugs and empty cell list in PM data generation
Issue-ID: INT-2112 Signed-off-by: Niranjana <niranjana.y60@wipro.com> Change-Id: I4186e9388cf38c34825831c52c68100939ceb807
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java7
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java106
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java3
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/server/RansimWebSocketServer.java2
4 files changed, 106 insertions, 12 deletions
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 7256f7b..a516022 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
@@ -171,9 +171,10 @@ public class RansimSlicingHandler {
}
}
-
- MeasValue measValue = new MeasValue(nRCellCUModel.getCellLocalId(), resultList, false);
- measValueList.add(measValue);
+ if (!resultList.isEmpty()) {
+ MeasValue measValue = new MeasValue(nRCellCUModel.getCellLocalId(), resultList, false);
+ measValueList.add(measValue);
+ }
}
ManagedElement managedElement = new ManagedElement("r0.1", gNBName);
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 7aad13a..2af13f2 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
@@ -1362,7 +1362,8 @@ public class RansimControllerServices {
List<PLMNInfo> pLMNInfoList = null;
org.onap.ransim.rest.api.models.PLMNInfoModel plmnInfoModel =
new Gson().fromJson(message, org.onap.ransim.rest.api.models.PLMNInfoModel.class);
- if (!(plmnInfoModel.getConfigData().get(0).getConfigParameter().equalsIgnoreCase("maxNumberOfConns"))
+ if (plmnInfoModel.getConfigData().size() > 0
+ && !(plmnInfoModel.getConfigData().get(0).getConfigParameter().equalsIgnoreCase("maxNumberOfConns"))
&& !(plmnInfoModel.getConfigData().get(0).getConfigParameter().equalsIgnoreCase("dLThptPerSlice"))
&& !(plmnInfoModel.getConfigData().get(0).getConfigParameter().equalsIgnoreCase("uLThptPerSlice"))
&& (plmnInfoModel.getGnbType().equalsIgnoreCase("gnbcucp"))) {
@@ -1397,9 +1398,22 @@ public class RansimControllerServices {
pLMNInfoList = nrCellDu.getpLMNInfoList();
for (org.onap.ransim.rest.api.models.PLMNInfo plmninfo : pLMNInfoList) {
if (plmninfo.getsNSSAI().getsNSSAI().equalsIgnoreCase(plmnInfoModel.getSnssai())) {
- plmninfo.getsNSSAI().setConfigData(sNSSAI.getConfigData());
+ if (Objects.nonNull(plmnInfoModel.getStatus())) {
+ plmninfo.getsNSSAI().setStatus(plmnInfoModel.getStatus());
+ }
+ if (Objects.nonNull(nSSAIConfig.getdLThptPerSlice())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setdLThptPerSlice(nSSAIConfig.getdLThptPerSlice());
+ }
+ if (Objects.nonNull(nSSAIConfig.getuLThptPerSlice())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setuLThptPerSlice(nSSAIConfig.getuLThptPerSlice());
+ }
+ if (Objects.nonNull(nSSAIConfig.getMaxNumberOfConns())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setMaxNumberOfConns(nSSAIConfig.getMaxNumberOfConns());
+ }
isAdded = true;
- log.info("data updated");
}
}
} else {
@@ -1408,6 +1422,7 @@ public class RansimControllerServices {
if (!(isAdded)) {
pLMNInfoList.add(plmnInfo);
}
+
nrCellDu.setpLMNInfoList(pLMNInfoList);
nRCellDURepository.save(nrCellDu);
} else if (plmnInfoModel.getGnbType().equalsIgnoreCase("gnbcucp")) {
@@ -1419,7 +1434,21 @@ public class RansimControllerServices {
pLMNInfoList = nrCellCu.getpLMNInfoList();
for (org.onap.ransim.rest.api.models.PLMNInfo plmninfo : pLMNInfoList) {
if (plmninfo.getsNSSAI().getsNSSAI().equalsIgnoreCase(plmnInfoModel.getSnssai())) {
- plmninfo.getsNSSAI().setConfigData(sNSSAI.getConfigData());
+ if (Objects.nonNull(plmnInfoModel.getStatus())) {
+ plmninfo.getsNSSAI().setStatus(plmnInfoModel.getStatus());
+ }
+ if (Objects.nonNull(nSSAIConfig.getdLThptPerSlice())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setdLThptPerSlice(nSSAIConfig.getdLThptPerSlice());
+ }
+ if (Objects.nonNull(nSSAIConfig.getuLThptPerSlice())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setuLThptPerSlice(nSSAIConfig.getuLThptPerSlice());
+ }
+ if (Objects.nonNull(nSSAIConfig.getMaxNumberOfConns())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setMaxNumberOfConns(nSSAIConfig.getMaxNumberOfConns());
+ }
isAdded = true;
log.info("data updated");
}
@@ -1441,7 +1470,21 @@ public class RansimControllerServices {
pLMNInfoList = gNBCUUPFunction.getpLMNInfoList();
for (org.onap.ransim.rest.api.models.PLMNInfo plmninfo : pLMNInfoList) {
if (plmninfo.getsNSSAI().getsNSSAI().equalsIgnoreCase(plmnInfoModel.getSnssai())) {
- plmninfo.getsNSSAI().setConfigData(sNSSAI.getConfigData());
+ if (Objects.nonNull(plmnInfoModel.getStatus())) {
+ plmninfo.getsNSSAI().setStatus(plmnInfoModel.getStatus());
+ }
+ if (Objects.nonNull(nSSAIConfig.getdLThptPerSlice())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setdLThptPerSlice(nSSAIConfig.getdLThptPerSlice());
+ }
+ if (Objects.nonNull(nSSAIConfig.getuLThptPerSlice())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setuLThptPerSlice(nSSAIConfig.getuLThptPerSlice());
+ }
+ if (Objects.nonNull(nSSAIConfig.getMaxNumberOfConns())) {
+ plmninfo.getsNSSAI().getConfigData()
+ .setMaxNumberOfConns(nSSAIConfig.getMaxNumberOfConns());
+ }
log.info("data updated");
isAdded = true;
}
@@ -1466,18 +1509,67 @@ public class RansimControllerServices {
public void handlePLMNInfoDeleteFromSdnr(String message, Session session, String ipPort) {
log.info("handle PLMNInfo Delete: " + message);
+ List<PLMNInfo> pLMNInfoList = null;
org.onap.ransim.rest.api.models.PLMNInfoModel plmnInfoModel =
new Gson().fromJson(message, org.onap.ransim.rest.api.models.PLMNInfoModel.class);
PLMNInfo plmnInfo = new PLMNInfo();
NSSAIConfig nSSAIConfig = new NSSAIConfig();
- // nSSAIConfig.setMaxNumberOfConns(plmnInfoModel.getConfigValue());
org.onap.ransim.rest.api.models.SNSSAI sNSSAI = new org.onap.ransim.rest.api.models.SNSSAI();
sNSSAI.setsNSSAI(plmnInfoModel.getSnssai());
sNSSAI.setStatus(plmnInfoModel.getStatus());
sNSSAI.setConfigData(nSSAIConfig);
plmnInfo.setpLMNId(plmnInfoModel.getpLMNId());
plmnInfo.setsNSSAI(sNSSAI);
- // pLMNInfoRepo.delete(plmnInfo);
+ try {
+ if (plmnInfoModel.getGnbType().equalsIgnoreCase("gnbdu")) {
+ org.onap.ransim.rest.api.models.NRCellDU nrCellDu =
+ nRCellDURepository.findById(plmnInfoModel.getNrCellId()).get();
+ if (!(Objects.isNull(nrCellDu.getpLMNInfoList()))) {
+ pLMNInfoList = nrCellDu.getpLMNInfoList();
+ for (org.onap.ransim.rest.api.models.PLMNInfo plmninfo : pLMNInfoList) {
+ if (plmninfo.getsNSSAI().getsNSSAI().equalsIgnoreCase(plmnInfoModel.getSnssai())) {
+ pLMNInfoList.remove(plmninfo);
+ nrCellDu.setpLMNInfoList(pLMNInfoList);
+ nRCellDURepository.save(nrCellDu);
+ }
+ }
+ }
+
+ } else if (plmnInfoModel.getGnbType().equalsIgnoreCase("gnbcucp")) {
+ org.onap.ransim.rest.api.models.NRCellCU nrCellCu =
+ nRCellCURepository.findById(plmnInfoModel.getNrCellId()).get();
+ if (!(Objects.isNull(nrCellCu.getpLMNInfoList()))) {
+ pLMNInfoList = nrCellCu.getpLMNInfoList();
+ for (org.onap.ransim.rest.api.models.PLMNInfo plmninfo : pLMNInfoList) {
+ if (plmninfo.getsNSSAI().getsNSSAI().equalsIgnoreCase(plmnInfoModel.getSnssai())) {
+ pLMNInfoList.remove(plmninfo);
+ nrCellCu.setpLMNInfoList(pLMNInfoList);
+ nRCellCURepository.save(nrCellCu);
+ }
+ }
+
+ }
+
+ } else {
+ org.onap.ransim.rest.api.models.GNBCUUPFunction gNBCUUPFunction =
+ gNBCUUPRepository.findBygNBCUUPId(plmnInfoModel.getGnbId()).get();
+ if (!(Objects.isNull(gNBCUUPFunction.getpLMNInfoList()))) {
+ pLMNInfoList = gNBCUUPFunction.getpLMNInfoList();
+ for (org.onap.ransim.rest.api.models.PLMNInfo plmninfo : pLMNInfoList) {
+ if (plmninfo.getsNSSAI().getsNSSAI().equalsIgnoreCase(plmnInfoModel.getSnssai())) {
+ pLMNInfoList.remove(plmninfo);
+ gNBCUUPFunction.setpLMNInfoList(pLMNInfoList);
+ gNBCUUPRepository.save(gNBCUUPFunction);
+ }
+ }
+
+ }
+ }
+ } catch (NullPointerException nullPointerException) {
+ log.error("Record does not exist");
+ } catch (Exception e) {
+ log.error("Unexpected error while fetching data from database: " + e);
+ }
}
public void handleSliceProfileUpdateFromSdnr(String message, Session session, String ipPort) {
diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java
index e61e14f..5fb2c27 100644
--- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java
+++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java
@@ -105,7 +105,8 @@ public class SlicingPMDataGenerator {
List<NRCellDUModel> duCellList = du.getCellDUList();
int ricId = du.getNearRTRICId();
List<PLMNInfoModel> plmnInfoList = new ArrayList<>();
- duCellList.stream().filter(cell -> (!Objects.isNull(cell.getpLMNInfoList())));
+ duCellList.stream()
+ .filter(cell -> (!Objects.isNull(cell.getpLMNInfoList()) && !cell.getpLMNInfoList().isEmpty()));
duCellList.forEach(cell -> plmnInfoList.addAll(cell.getpLMNInfoList()));
List<NSSAIData> nssaiData = new ArrayList<>();
plmnInfoList.forEach(plmnInfo -> nssaiData.add(plmnInfo.getsNSSAI()));
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 6168764..f8928e9 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
@@ -129,7 +129,7 @@ public class RansimWebSocketServer {
rscServices.handleRRMPolicyRatioUpdateFromSdnr(message.getMessage(), session, ipPort);
} else if (message.getType().equals(MessageTypes.HC_TO_RC_PLMN)) {
log.info("Add PLMNInfo message received");
- rscServices.handleRTRICConfigFromSdnr(message.getMessage(), session, ipPort);
+ rscServices.handlePLMNInfoUpdateFromSdnr(message.getMessage(), session, ipPort);
} else if (message.getType().equals(MessageTypes.HC_TO_RC_SLICE_PROFILE)) {
log.info("Add SliceProfile message received");
rscServices.handleSliceProfileUpdateFromSdnr(message.getMessage(), session, ipPort);