aboutsummaryrefslogtreecommitdiffstats
path: root/ransim/ransimctrlr/RANSIM-CTRLR
diff options
context:
space:
mode:
authorNiranjana <niranjana.y60@wipro.com>2021-08-25 14:29:52 +0000
committerNiranjana <niranjana.y60@wipro.com>2021-08-25 14:29:52 +0000
commit8ea7b39efe67d3af3236948782f3046d2a858a3a (patch)
treeda0dfdd2026ab66d6601c92d0faf968beff42676 /ransim/ransimctrlr/RANSIM-CTRLR
parent410d8e3b6e201d607f6c7c291ed7125cfd7103aa (diff)
Fix bug in intelligent-slicing part
Issue-ID: INT-1961 Signed-off-by: Niranjana <niranjana.y60@wipro.com> Change-Id: Ibef2149b8bc36a929adbd8eb6406600c9f1f6810
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-CTRLR')
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java8
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java102
2 files changed, 52 insertions, 58 deletions
diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java
index cab1c47..1151ef9 100644
--- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java
+++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java
@@ -30,7 +30,7 @@ public class PLMNInfoModel {
private String status;
private String gnbType;
private String gnbId;
- private int nrCellId;
+ private Integer nrCellId;
private String nearrtricid;
private List<ConfigData> configData;
@@ -38,7 +38,7 @@ public class PLMNInfoModel {
}
- public PLMNInfoModel(String pLMNId, String snssai, String status, String gnbType, String gnbId, int nrCellId,
+ public PLMNInfoModel(String pLMNId, String snssai, String status, String gnbType, String gnbId, Integer nrCellId,
String nearrtricid, List<ConfigData> configData) {
super();
this.pLMNId = pLMNId;
@@ -91,11 +91,11 @@ public class PLMNInfoModel {
this.gnbId = gnbId;
}
- public int getNrCellId() {
+ public Integer getNrCellId() {
return nrCellId;
}
- public void setNrCellId(int nrCellId) {
+ public void setNrCellId(Integer nrCellId) {
this.nrCellId = nrCellId;
}
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 235bc80..514666f 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
@@ -1379,66 +1379,60 @@ public class RansimControllerServices {
log.info("handle Intelligent Slicing data From Sdnr : " + message);
org.onap.ransim.rest.api.models.PLMNInfoModel plmnInfoModel =
new Gson().fromJson(message, org.onap.ransim.rest.api.models.PLMNInfoModel.class);
- String[] ipPortlist = ipPort.split(":");
- List<NetconfServers> netconfServers = (List<NetconfServers>) netconfServersRepo.findAll();
- for (NetconfServers server : netconfServers) {
- if (!(Objects.isNull(server.getNetconfPort()))) {
- if (server.getNetconfPort().equalsIgnoreCase(ipPortlist[1].trim())) {
- String netconfServerId = server.getServerId();
- log.info("netconfServerId: " + netconfServerId);
- List<GNBCUCPModel> gNBCUCPModelList = new ArrayList<>();
- HttpHeaders headers = new HttpHeaders();
- headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
- HttpEntity<Void> requestEntity = new HttpEntity<>(headers);
- try {
- RestTemplate restTemplate = new RestTemplate();
-
- ResponseEntity<List<GNBCUCPModel>> response = restTemplate.exchange(
- "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/cucp-list/",
- HttpMethod.GET, requestEntity, new ParameterizedTypeReference<List<GNBCUCPModel>>() {});
- gNBCUCPModelList = response.getBody();
- gNBCUCPModelList.forEach(gnb -> {
- GNBCUCPModel gNBCUCPModel = gnb;
- log.info("gNBCUCPModel: " + gNBCUCPModel.toString());
- List<NRCellCUModel> nRCellCUModelList = gnb.getCellCUList();
- for (NRCellCUModel nrcell : nRCellCUModelList) {
- if ((int) nrcell.getCellLocalId() == Integer
- .parseInt(plmnInfoModel.getConfigData().get(0).getConfigParameter())) {
- plmnInfoModel.setGnbId(Integer.toString(gnb.getgNBId()));
- List<PLMNInfoModel> pLMNInfoModelList = nrcell.getpLMNInfoList();
- pLMNInfoModelList.forEach(plmn -> {
- if (plmn.getpLMNId().equalsIgnoreCase(plmnInfoModel.getpLMNId())) {
- if (plmn.getsNSSAI().getsNSSAI()
- .equalsIgnoreCase(plmnInfoModel.getSnssai())) {
- plmnInfoModel.setStatus(plmn.getsNSSAI().getStatus());
- log.info("plmn status set");
- }
- }
- });
- NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin",
- netconfServerId, server.getIp(), Integer.parseInt(server.getNetconfPort()));
-
- netconfClient.editConfig(netconfClient
- .sendUpdatedPLMNInfoForIntelligentSlicing(plmnInfoModel, netconfServerId));
- log.info("Intelligent Slicing Data sent successfully : ");
- plmnInfoModel.getConfigData().get(0).setConfigParameter("maxNumberOfConns");
- try {
- ObjectMapper obj = new ObjectMapper();
- String plmnString = obj.writeValueAsString(plmnInfoModel);
- handlePLMNInfoUpdateFromSdnr(plmnString, session, ipPort);
- } catch (Exception e) {
- log.info("Exception while parsing:", e);
+ plmnInfoModel.getConfigData().get(0).setConfigParameter("maxNumberOfConns");
+ log.info("plmnInfoModel: " + plmnInfoModel.toString());
+ List<GNBCUCPModel> gNBCUCPModelList = new ArrayList<>();
+ HttpHeaders headers = new HttpHeaders();
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ HttpEntity<Void> requestEntity = new HttpEntity<>(headers);
+ try {
+ RestTemplate restTemplate = new RestTemplate();
+
+ ResponseEntity<List<GNBCUCPModel>> response = restTemplate.exchange(
+ "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/cucp-list/", HttpMethod.GET,
+ requestEntity, new ParameterizedTypeReference<List<GNBCUCPModel>>() {});
+ gNBCUCPModelList = response.getBody();
+ gNBCUCPModelList.forEach(gnb -> {
+ GNBCUCPModel gNBCUCPModel = gnb;
+ log.info("gNBCUCPModel: " + gNBCUCPModel.toString());
+ List<NRCellCUModel> nRCellCUModelList = gnb.getCellCUList();
+ for (NRCellCUModel nrcell : nRCellCUModelList) {
+ if (nrcell.getCellLocalId().equals(plmnInfoModel.getNrCellId())) {
+ plmnInfoModel.setGnbId(gnb.getgNBCUName());
+ List<PLMNInfoModel> pLMNInfoModelList = nrcell.getpLMNInfoList();
+ pLMNInfoModelList.forEach(plmn -> {
+ if (plmn.getpLMNId().equalsIgnoreCase(plmnInfoModel.getpLMNId())) {
+ if (plmn.getsNSSAI().getsNSSAI().equalsIgnoreCase(plmnInfoModel.getSnssai())) {
+ if (Objects.isNull(plmnInfoModel.getStatus())) {
+ plmnInfoModel.setStatus(plmn.getsNSSAI().getStatus());
+ log.info("plmn status set");
}
-
- break;
}
}
});
- } catch (Exception e) {
- log.info("Exception:", e);
+ String serverId = plmnInfoModel.getGnbId();
+ String ipPortKey = serverIdIpPortMapping.get(serverId);
+ String[] ipPortlist = ipPortKey.split(":");
+ NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin", serverId,
+ ipPortlist[0], Integer.parseInt(ipPortlist[1]));
+
+ netconfClient.editConfig(
+ netconfClient.sendUpdatedPLMNInfoForIntelligentSlicing(plmnInfoModel, serverId));
+ log.info("Intelligent Slicing Data sent successfully : ");
+ try {
+ ObjectMapper obj = new ObjectMapper();
+ String plmnString = obj.writeValueAsString(plmnInfoModel);
+ handlePLMNInfoUpdateFromSdnr(plmnString, session, ipPort);
+ } catch (Exception e) {
+ log.info("Exception while parsing:", e);
+ }
+
+ break;
}
}
- }
+ });
+ } catch (Exception e) {
+ log.info("Exception:", e);
}
}