aboutsummaryrefslogtreecommitdiffstats
path: root/ransim/ransimctrlr/RANSIM-CTRLR
diff options
context:
space:
mode:
authorNiranjana <niranjana.y60@wipro.com>2021-06-15 10:19:24 +0000
committerNiranjana <niranjana.y60@wipro.com>2021-06-15 10:19:24 +0000
commit410d8e3b6e201d607f6c7c291ed7125cfd7103aa (patch)
tree59482d59880df52add6ea0b4d7c278a6944c9f09 /ransim/ransimctrlr/RANSIM-CTRLR
parentf11ea46a4b97f89c27d3c7129fb2500b54cc04f7 (diff)
Fix bugs in updating RIC data in ransim db
Issue-ID: INT-1931 Signed-off-by: Niranjana <niranjana.y60@wipro.com> Change-Id: Icc268e6168f1a7f93514b2168e53a838bfe663d7
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-CTRLR')
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java121
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java3
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java6
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java2
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java40
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java6
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java3
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java153
-rw-r--r--ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java5
9 files changed, 242 insertions, 97 deletions
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 e3a4261..46d4e05 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
@@ -28,6 +28,7 @@ import com.tailf.jnc.NetconfSession;
import java.io.IOException;
import java.net.ConnectException;
+import java.util.List;
import org.apache.log4j.Logger;
import org.onap.ransim.rest.api.models.PLMNInfoModel;
@@ -37,6 +38,7 @@ 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.NearRTRICModel;
+import org.onap.ransim.websocket.model.ConfigData;
public class NetconfClient {
@@ -212,9 +214,90 @@ public class NetconfClient {
}
- public Element sendIntelligentSlicingData(PLMNInfoModel pLMNInfoModel, String serverId) {
+ public Element sendUpdatedPLMNInfoForClosedLoop(PLMNInfoModel pLMNInfoModel, String serverId) {
try {
- log.info("sending Intelligent Slicing netconf data");
+ log.info("sending PLMNInfo data to netconf server");
+ Element ranNetworkElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/ran-network");
+ Element nearRTRICElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/NearRTRIC");
+ Element idNearRTRICElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/idNearRTRIC");
+ idNearRTRICElement.setValue(pLMNInfoModel.getNearrtricid());
+
+ Element gNBDUFunctionElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/GNBDUFunction");
+ Element idGNBDUFunctionElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/idGNBDUFunction");
+ idGNBDUFunctionElement.setValue(pLMNInfoModel.getGnbId());
+
+ Element nRCellDUElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/NRCellDU");
+ Element idNRCellDUElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/idNRCellDU");
+ idNRCellDUElement.setValue(pLMNInfoModel.getNrCellId());
+ Element nRCellattributesElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes");
+ Element pLMNInfoListElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/pLMNInfoList");
+ Element mccElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/mcc");
+ Element mncElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/mnc");
+ String[] plmn = pLMNInfoModel.getpLMNId().split("-");
+ mccElement.setValue(plmn[0]);
+ mncElement.setValue(plmn[1]);
+
+ Element sNSSAIListElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/sNSSAIList");
+ Element sNssaiElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/sNssai");
+ sNssaiElement.setValue(pLMNInfoModel.getSnssai());
+
+ List<ConfigData> configDataList = pLMNInfoModel.getConfigData();
+ for (ConfigData c : configDataList) {
+ Element configDataElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configData");
+ Element configParameterElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configParameter");
+ configParameterElement.setValue(c.getConfigParameter());
+ Element configValueElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configValue");
+ configValueElement.setValue(c.getConfigValue());
+ configDataElement.markMerge();
+ configDataElement.addChild(configParameterElement);
+ configDataElement.addChild(configValueElement);
+ sNSSAIListElement.addChild(configDataElement);
+ }
+
+ sNSSAIListElement.markMerge();
+ sNSSAIListElement.addChild(sNssaiElement);
+
+ pLMNInfoListElement.addChild(mccElement);
+ pLMNInfoListElement.addChild(mncElement);
+ pLMNInfoListElement.addChild(sNSSAIListElement);
+
+ nRCellattributesElement.addChild(pLMNInfoListElement);
+ nRCellDUElement.addChild(idNRCellDUElement);
+ nRCellDUElement.addChild(nRCellattributesElement);
+
+ gNBDUFunctionElement.addChild(idGNBDUFunctionElement);
+ gNBDUFunctionElement.addChild(nRCellDUElement);
+
+ nearRTRICElement.addChild(idNearRTRICElement);
+ nearRTRICElement.addChild(gNBDUFunctionElement);
+
+ ranNetworkElement.addChild(nearRTRICElement);
+ ranNetworkElement.markMerge();
+ return ranNetworkElement;
+
+ } catch (JNCException e) {
+ log.error("Exception occured during NodeSet creation {}", e);
+ return null;
+ }
+
+ }
+
+ public Element sendUpdatedPLMNInfoForIntelligentSlicing(PLMNInfoModel pLMNInfoModel, String serverId) {
+ try {
+ log.info("sending PLMNInfo data to netconf server");
Element ranNetworkElement =
Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/ran-network");
Element nearRTRICElement =
@@ -233,7 +316,7 @@ public class NetconfClient {
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(pLMNInfoModel.getConfigParameter());
+ idNRCellCUElement.setValue(pLMNInfoModel.getNrCellId());
Element nRCellattributesElement =
Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes");
Element pLMNInfoListElement =
@@ -241,31 +324,31 @@ public class NetconfClient {
Element mccElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/mcc");
Element mncElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/mnc");
String[] plmn = pLMNInfoModel.getpLMNId().split("-");
- log.info("plmn list" + plmn);
mccElement.setValue(plmn[0]);
mncElement.setValue(plmn[1]);
+
Element sNSSAIListElement =
Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/sNSSAIList");
Element sNssaiElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/sNssai");
sNssaiElement.setValue(pLMNInfoModel.getSnssai());
- Element statusElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/status");
- statusElement.setValue(pLMNInfoModel.getStatus());
- Element configDataElement =
- Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configData");
- Element configParameterElement =
- Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configParameter");
- configParameterElement.setValue("maxNumberOfConns");
- Element configValueElement =
- Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configValue");
- configValueElement.setValue(pLMNInfoModel.getConfigValue());
-
- configDataElement.addChild(configParameterElement);
- configDataElement.addChild(configValueElement);
+
+ List<ConfigData> configDataList = pLMNInfoModel.getConfigData();
+ for (ConfigData c : configDataList) {
+ Element configDataElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configData");
+ Element configParameterElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configParameter");
+ configParameterElement.setValue(c.getConfigParameter());
+ Element configValueElement =
+ Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/configValue");
+ configValueElement.setValue(c.getConfigValue());
+ configDataElement.addChild(configParameterElement);
+ configDataElement.addChild(configValueElement);
+ sNSSAIListElement.addChild(configDataElement);
+ }
sNSSAIListElement.markReplace();
sNSSAIListElement.addChild(sNssaiElement);
- sNSSAIListElement.addChild(statusElement);
- sNSSAIListElement.addChild(configDataElement);
pLMNInfoListElement.addChild(mccElement);
pLMNInfoListElement.addChild(mncElement);
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 43e80d6..7256f7b 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
@@ -136,8 +136,7 @@ public class RansimSlicingHandler {
if (Integer.parseInt(cell) == nRCellCUModel.getCellLocalId().intValue()) {
long end = (System.currentTimeMillis());
if (peakEndTime > end) {
- if (taCellMap.getKey()==101
- || taCellMap.getKey()==303) {
+ 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/GNBCUUPFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java
index 790a638..9b6e95a 100644
--- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java
+++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java
@@ -40,7 +40,7 @@ public class GNBCUUPFunction implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "GNBCUUPID")
- private Integer gNBCUUPId;
+ private String gNBCUUPId;
@Column(name = "GNBID")
private Integer gNBId;
@Column(name = "GNBIDLENGTH")
@@ -57,11 +57,11 @@ public class GNBCUUPFunction implements Serializable {
@JoinColumn(name = "nearrtricid")
private NearRTRIC nearRTRIC;
- public Integer getgNBCUUPId() {
+ public String getgNBCUUPId() {
return gNBCUUPId;
}
- public void setgNBCUUPId(Integer gNBCUUPId) {
+ public void setgNBCUUPId(String gNBCUUPId) {
this.gNBCUUPId = gNBCUUPId;
}
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 961e048..8173d06 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,7 +42,7 @@ 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<Integer> trackingArea;
@Column(name = "RESOURCETYPE")
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 bdeb9b2..cab1c47 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
@@ -20,23 +20,26 @@
package org.onap.ransim.rest.api.models;
+import java.util.List;
+
+import org.onap.ransim.websocket.model.ConfigData;
+
public class PLMNInfoModel {
private String pLMNId;
private String snssai;
private String status;
private String gnbType;
- private int gnbId;
+ private String gnbId;
private int nrCellId;
private String nearrtricid;
- private String configParameter;
- private Integer configValue;
+ private List<ConfigData> configData;
public PLMNInfoModel() {
}
- public PLMNInfoModel(String pLMNId, String snssai, String status, String gnbType, int gnbId, int nrCellId,
- String nearrtricid, String configParameter, Integer configValue) {
+ public PLMNInfoModel(String pLMNId, String snssai, String status, String gnbType, String gnbId, int nrCellId,
+ String nearrtricid, List<ConfigData> configData) {
super();
this.pLMNId = pLMNId;
this.snssai = snssai;
@@ -45,8 +48,7 @@ public class PLMNInfoModel {
this.gnbId = gnbId;
this.nrCellId = nrCellId;
this.nearrtricid = nearrtricid;
- this.configParameter = configParameter;
- this.configValue = configValue;
+ this.configData = configData;
}
public String getpLMNId() {
@@ -81,11 +83,11 @@ public class PLMNInfoModel {
this.gnbType = gnbType;
}
- public int getGnbId() {
+ public String getGnbId() {
return gnbId;
}
- public void setGnbId(int gnbId) {
+ public void setGnbId(String gnbId) {
this.gnbId = gnbId;
}
@@ -105,26 +107,18 @@ public class PLMNInfoModel {
this.nearrtricid = nearrtricid;
}
- public String getConfigParameter() {
- return configParameter;
- }
-
- public void setConfigParameter(String configParameter) {
- this.configParameter = configParameter;
- }
-
- public Integer getConfigValue() {
- return configValue;
+ public List<ConfigData> getConfigData() {
+ return configData;
}
- public void setConfigValue(Integer configValue) {
- this.configValue = configValue;
+ public void setConfigData(List<ConfigData> configData) {
+ this.configData = configData;
}
@Override
public String toString() {
return "PLMNInfoModel [pLMNId=" + pLMNId + ", snssai=" + snssai + ", status=" + status + ", gnbType=" + gnbType
- + ", gnbId=" + gnbId + ", nrCellId=" + nrCellId + ", nearrtricid=" + nearrtricid + ", configParameter="
- + configParameter + ", configValue=" + configValue + "]";
+ + ", gnbId=" + gnbId + ", nrCellId=" + nrCellId + ", nearrtricid=" + nearrtricid + ", configData="
+ + configData + "]";
}
}
diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java
index 33546c3..aec625c 100644
--- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java
+++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java
@@ -37,7 +37,7 @@ public class RRMPolicyRatio implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "RRMPOLICYID")
- private Integer rrmPolicyID;
+ private String rrmPolicyID;
@Column(name = "RESOURCEID")
private String resourceID;
@Column(name = "RESOURCETYPE")
@@ -56,11 +56,11 @@ public class RRMPolicyRatio implements Serializable {
@Column(name = "RRMPOLICYDEDICATEDRATIO")
private Integer rRMPolicyDedicatedRatio;
- public Integer getRrmPolicyID() {
+ public String getRrmPolicyID() {
return rrmPolicyID;
}
- public void setRrmPolicyID(Integer rrmPolicyID) {
+ public void setRrmPolicyID(String rrmPolicyID) {
this.rrmPolicyID = rrmPolicyID;
}
diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java
index 8bb2ad2..93d99fb 100644
--- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java
+++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java
@@ -20,6 +20,8 @@
package org.onap.ransim.rest.api.repository;
+import java.util.Optional;
+
import org.onap.ransim.rest.api.models.GNBCUUPFunction;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@@ -27,4 +29,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface GNBCUUPRepository extends CrudRepository<GNBCUUPFunction, Integer> {
+ public Optional<GNBCUUPFunction> findBygNBCUUPId(String gNBCUUPId);
}
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 571994c..235bc80 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
@@ -1172,39 +1172,58 @@ public class RansimControllerServices {
}
public void handleRTRICConfigFromSdnr(String message, Session session, String ipPort) {
- log.info("handleReconfigureRTRICFromSDNR: message:" + message + " session:" + session + " ipPort:" + ipPort);
- ConfigPLMNInfo configPLMNInfo = new Gson().fromJson(message, ConfigPLMNInfo.class);
- log.info("handleReconfigureRTRICFromSDNR:" + configPLMNInfo.getSNSSAI());
- List<GNBDUModel> gNBDUModelList = 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<GNBDUModel>> response = restTemplate.exchange(
- "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/du-list"
- + configPLMNInfo.getSNSSAI().get(0),
- HttpMethod.GET, requestEntity, new ParameterizedTypeReference<List<GNBDUModel>>() {});
- gNBDUModelList = response.getBody();
- } catch (Exception e) {
- log.info("Exception:", e);
- }
- for (GNBDUModel gNBDUModel : gNBDUModelList) {
- String serverId = gNBDUModel.getgNBDUId().toString();
- int duCellCount = gNBDUModel.getCellDUList().size();
- for (SNSSAI sNSSAI : configPLMNInfo.getSNSSAI()) {
- for (ConfigData configData : sNSSAI.getConfigData()) {
+ 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"))
+ && !(plmnInfoModel.getConfigData().get(0).getConfigParameter().equalsIgnoreCase("dLThptPerSlice"))
+ && !(plmnInfoModel.getConfigData().get(0).getConfigParameter().equalsIgnoreCase("uLThptPerSlice"))) {
+ handleIntelligentSlicingDataFromSdnr(message, session, ipPort);
+ } else {
+
+ log.info(
+ "handleReconfigureRTRICFromSDNR: message:" + message + " session:" + session + " ipPort:" + ipPort);
+
+ List<GNBDUModel> gNBDUModelList = 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<GNBDUModel>> response = restTemplate.exchange(
+ "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/du-list/"
+ + plmnInfoModel.getSnssai(),
+ HttpMethod.GET, requestEntity, new ParameterizedTypeReference<List<GNBDUModel>>() {});
+ gNBDUModelList = response.getBody();
+ } catch (Exception e) {
+ log.error("Exception:", e);
+ }
+ for (GNBDUModel gNBDUModel : gNBDUModelList) {
+ plmnInfoModel = new Gson().fromJson(message, org.onap.ransim.rest.api.models.PLMNInfoModel.class);
+ String serverId = gNBDUModel.getgNBDUId().toString();
+ int duCellCount = gNBDUModel.getCellDUList().size();
+ for (ConfigData configData : plmnInfoModel.getConfigData()) {
configData.setConfigValue((configData.getConfigValue()) / duCellCount);
}
+ for (org.onap.ransim.rest.web.mapper.NRCellDUModel nrcelldu : gNBDUModel.getCellDUList()) {
+ plmnInfoModel.setNrCellId(nrcelldu.getCellLocalId());
+ plmnInfoModel.setGnbType("gnbdu");
+ plmnInfoModel.setGnbId(gNBDUModel.getgNBDUId().toString());
+ try {
+ log.info("serverId" + serverId);
+ String ipPortKey = serverIdIpPortMapping.get(serverId);
+ String[] ipPortlist = ipPortKey.split(":");
+ ObjectMapper obj = new ObjectMapper();
+ String plmnString = obj.writeValueAsString(plmnInfoModel);
+ handlePLMNInfoUpdateFromSdnr(plmnString, session, ipPort);
+ NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin", serverId,
+ ipPortlist[0], Integer.parseInt(ipPortlist[1]));
+ netconfClient
+ .editConfig(netconfClient.sendUpdatedPLMNInfoForClosedLoop(plmnInfoModel, serverId));
+ } catch (Exception e) {
+ log.error("Exception occured:", e);
+ }
+ }
}
- String ipPortKey = serverIdIpPortMapping.get(serverId);
- log.info("sendConfigRTRICMessage: ipPortKey:" + ipPortKey);
-
- Gson gson = new Gson();
- String jsonStr = gson.toJson(configPLMNInfo);
- log.info("ConfigRTRICMessage: " + jsonStr);
- Session duSession = webSocketSessions.get(ipPortKey);
- RansimWebSocketServer.sendSetReconfigureMessage(jsonStr, duSession);
}
}
@@ -1225,13 +1244,26 @@ 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.getConfigParameter().equalsIgnoreCase("maxNumberOfConns"))
- && plmnInfoModel.getGnbType().equalsIgnoreCase("gnbcucp")) {
+ if (!(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"))) {
handleIntelligentSlicingDataFromSdnr(message, session, ipPort);
} else {
PLMNInfo plmnInfo = new PLMNInfo();
NSSAIConfig nSSAIConfig = new NSSAIConfig();
- nSSAIConfig.setMaxNumberOfConns(plmnInfoModel.getConfigValue());
+ List<ConfigData> configDataList = plmnInfoModel.getConfigData();
+ for (ConfigData c : configDataList) {
+ if (c.getConfigParameter().equalsIgnoreCase("maxNumberOfConns")) {
+ nSSAIConfig.setMaxNumberOfConns(c.getConfigValue());
+ }
+ if (c.getConfigParameter().equalsIgnoreCase("dLThptPerSlice")) {
+ nSSAIConfig.setdLThptPerSlice(c.getConfigValue());
+ }
+ if (c.getConfigParameter().equalsIgnoreCase("uLThptPerSlice")) {
+ nSSAIConfig.setuLThptPerSlice(c.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());
@@ -1242,34 +1274,67 @@ public class RansimControllerServices {
if (plmnInfoModel.getGnbType().equalsIgnoreCase("gnbdu")) {
org.onap.ransim.rest.api.models.NRCellDU nrCellDu =
nRCellDURepository.findById(plmnInfoModel.getNrCellId()).get();
+ boolean isAdded = false;
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())) {
+ plmninfo.getsNSSAI().setConfigData(sNSSAI.getConfigData());
+ isAdded = true;
+ log.info("data updated");
+ }
+ }
} else {
pLMNInfoList = new ArrayList<PLMNInfo>();
}
- pLMNInfoList.add(plmnInfo);
+ if (!(isAdded)) {
+ pLMNInfoList.add(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();
+ boolean isAdded = false;
+
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())) {
+ plmninfo.getsNSSAI().setConfigData(sNSSAI.getConfigData());
+ isAdded = true;
+ log.info("data updated");
+ }
+ }
+
} else {
pLMNInfoList = new ArrayList<PLMNInfo>();
}
- pLMNInfoList.add(plmnInfo);
+ if (!(isAdded)) {
+ pLMNInfoList.add(plmnInfo);
+ }
nrCellCu.setpLMNInfoList(pLMNInfoList);
nRCellCURepository.save(nrCellCu);
} else {
org.onap.ransim.rest.api.models.GNBCUUPFunction gNBCUUPFunction =
- gNBCUUPRepository.findById(plmnInfoModel.getGnbId()).get();
+ gNBCUUPRepository.findBygNBCUUPId(plmnInfoModel.getGnbId()).get();
+ boolean isAdded = false;
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())) {
+ plmninfo.getsNSSAI().setConfigData(sNSSAI.getConfigData());
+ log.info("data updated");
+ isAdded = true;
+ }
+ }
+
} else {
pLMNInfoList = new ArrayList<PLMNInfo>();
}
- pLMNInfoList.add(plmnInfo);
+ if (!(isAdded)) {
+ pLMNInfoList.add(plmnInfo);
+ }
gNBCUUPFunction.setpLMNInfoList(pLMNInfoList);
gNBCUUPRepository.save(gNBCUUPFunction);
}
@@ -1287,7 +1352,7 @@ public class RansimControllerServices {
new Gson().fromJson(message, org.onap.ransim.rest.api.models.PLMNInfoModel.class);
PLMNInfo plmnInfo = new PLMNInfo();
NSSAIConfig nSSAIConfig = new NSSAIConfig();
- nSSAIConfig.setMaxNumberOfConns(plmnInfoModel.getConfigValue());
+ // 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());
@@ -1315,8 +1380,6 @@ public class RansimControllerServices {
org.onap.ransim.rest.api.models.PLMNInfoModel plmnInfoModel =
new Gson().fromJson(message, org.onap.ransim.rest.api.models.PLMNInfoModel.class);
String[] ipPortlist = ipPort.split(":");
- log.info("ip: " + ipPortlist[0]);
- log.info("Port: " + ipPortlist[1]);
List<NetconfServers> netconfServers = (List<NetconfServers>) netconfServersRepo.findAll();
for (NetconfServers server : netconfServers) {
if (!(Objects.isNull(server.getNetconfPort()))) {
@@ -1340,8 +1403,8 @@ public class RansimControllerServices {
List<NRCellCUModel> nRCellCUModelList = gnb.getCellCUList();
for (NRCellCUModel nrcell : nRCellCUModelList) {
if ((int) nrcell.getCellLocalId() == Integer
- .parseInt(plmnInfoModel.getConfigParameter())) {
- plmnInfoModel.setGnbId(gnb.getgNBId());
+ .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())) {
@@ -1355,10 +1418,10 @@ public class RansimControllerServices {
NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin",
netconfServerId, server.getIp(), Integer.parseInt(server.getNetconfPort()));
- netconfClient.editConfig(
- netconfClient.sendIntelligentSlicingData(plmnInfoModel, netconfServerId));
+ netconfClient.editConfig(netconfClient
+ .sendUpdatedPLMNInfoForIntelligentSlicing(plmnInfoModel, netconfServerId));
log.info("Intelligent Slicing Data sent successfully : ");
- plmnInfoModel.setConfigParameter("maxNumberOfConns");
+ plmnInfoModel.getConfigData().get(0).setConfigParameter("maxNumberOfConns");
try {
ObjectMapper obj = new ObjectMapper();
String plmnString = obj.writeValueAsString(plmnInfoModel);
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 1a74c25..e61e14f 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
@@ -31,6 +31,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -104,10 +105,12 @@ 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.forEach(cell -> plmnInfoList.addAll(cell.getpLMNInfoList()));
List<NSSAIData> nssaiData = new ArrayList<>();
plmnInfoList.forEach(plmnInfo -> nssaiData.add(plmnInfo.getsNSSAI()));
- nssaiData.stream().filter(nssai -> nssai.getStatus().equalsIgnoreCase("active"))
+ nssaiData.stream().filter(
+ nssai -> (!(Objects.isNull(nssai.getStatus()))) && nssai.getStatus().equalsIgnoreCase("active"))
.forEach(x -> activeNssaiDetails.put(x.getsNSSAI(), x.getConfigData()));
produceMeasurementCollectionFile(du, activeNssaiDetails, duCellList, ricId);
logger.info("PM data generated for DU : " + du.getgNBDUName() + " Id: " + du.getgNBDUId());