diff options
author | Niranjana <niranjana.y60@wipro.com> | 2021-06-15 10:19:24 +0000 |
---|---|---|
committer | Niranjana <niranjana.y60@wipro.com> | 2021-06-15 10:19:24 +0000 |
commit | 410d8e3b6e201d607f6c7c291ed7125cfd7103aa (patch) | |
tree | 59482d59880df52add6ea0b4d7c278a6944c9f09 /ransim | |
parent | f11ea46a4b97f89c27d3c7129fb2500b54cc04f7 (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')
10 files changed, 302 insertions, 142 deletions
diff --git a/ransim/docker/config/db/ransim_schema.sql b/ransim/docker/config/db/ransim_schema.sql index 7b129fe..ecb9687 100644 --- a/ransim/docker/config/db/ransim_schema.sql +++ b/ransim/docker/config/db/ransim_schema.sql @@ -89,7 +89,7 @@ create table gnbcucpfunction ( -- Table `ransim_db`.`gnbcuupfunction` -- ----------------------------------------------------- create table gnbcuupfunction ( - gnbcuupid integer not null, + gnbcuupid varchar(255) not null, gnbid integer, gnbidlength integer, resourcetype varchar(255), @@ -156,7 +156,7 @@ create table rannssi ( -- Table `ransim_db`.`rrmpolicyratio` -- ----------------------------------------------------- create table rrmpolicyratio ( - rrmpolicyid integer not null, + rrmpolicyid varchar(255) not null, quotatype varchar(255), rrmpolicydedicatedratio integer, rrmpolicymaxratio integer, @@ -192,7 +192,7 @@ create table plmninfo ( snssai varchar(255), status varchar(255), subscriptionServiceType varchar(255), - gnbcuupid integer, + gnbcuupid varchar(255), nrcellcu_celllocalid integer, nrcelldu_celllocalid integer, nearrtricid integer, @@ -230,22 +230,36 @@ INSERT INTO tacells(trackingarea,cells) VALUES(202, '15176,15825,15826,15425,154 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'); +INSERT INTO tacells(trackingarea,cells) VALUES(505, '10896,10897,13905,13910'); +INSERT INTO tacells(trackingarea,cells) VALUES(606, '15360,15361,15548,15549'); +INSERT INTO tacells(trackingarea,cells) VALUES(707, '15425,15426,15427'); +INSERT INTO tacells(trackingarea,cells) VALUES(808, '15687,15689'); +INSERT INTO tacells(trackingarea,cells) VALUES(909, '14655,14656'); + --nearrtric -INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(11, 98763, 'NearRTRIC'); -INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(22, 98763, 'NearRTRIC'); +INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(11, 25, 'NearRTRIC'); +INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(22, 25, 'NearRTRIC'); --gnbcucpfunction -INSERT INTO gnbcucpfunction(gnbcuname, gnbid, gnbidlength, nftype,plmnid,nearrtricid) VALUES('cucpserver1', 98763, 32, 'CUCP', '310-410', 11); -INSERT INTO gnbcucpfunction(gnbcuname, gnbid, gnbidlength, nftype,plmnid,nearrtricid) VALUES('cucpserver2', 98763, 32, 'CUCP', '310-410',22); +INSERT INTO gnbcucpfunction(gnbcuname, gnbid, gnbidlength, nftype,plmnid,nearrtricid) VALUES('cucpserver1', 25, 25, 'CUCP', '310-410', 11); +INSERT INTO gnbcucpfunction(gnbcuname, gnbid, gnbidlength, nftype,plmnid,nearrtricid) VALUES('cucpserver2', 25, 25, 'CUCP', '310-410',22); + --gnbcuupfunction -INSERT INTO gnbcuupfunction(gnbcuupid, gnbid, gnbidlength, resourcetype, nearrtricid) VALUES(1111, 98763, 32, 'DRB', 11); -INSERT INTO gnbcuupfunction(gnbcuupid, gnbid, gnbidlength, resourcetype, nearrtricid) VALUES(2222, 98763, 32, 'DRB', 22); +INSERT INTO gnbcuupfunction(gnbcuupid, gnbid, gnbidlength, resourcetype, nearrtricid) VALUES(1111, 25, 25, 'DRB', 11); +INSERT INTO gnbcuupfunction(gnbcuupid, gnbid, gnbidlength, resourcetype, nearrtricid) VALUES(2222, 25, 25, 'DRB', 22); + --gnbdufunction -INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(1,'gnduserver1', 98763, 32, 'DU', '310-410', 11); -INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(2,'gnduserver2', 98763, 32, 'DU', '310-410', 11); -INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(3,'gnduserver3', 98763, 32, 'DU', '310-410', 11); -INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(4,'gnduserver4', 98763, 32, 'DU', '310-410', 22); -INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(5,'gnduserver5', 98763, 32, 'DU', '310-410', 22); -INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(6,'gnduserver6', 98763, 32, 'DU', '310-410', 22); +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(110,'gnduserver1', 25, 25, 'DU', '310-410', 11); + +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(220,'gnduserver2', 25, 25, 'DU', '310-410', 11); + +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(330,'gnduserver3', 25, 25, 'DU', '310-410', 11); + +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(440,'gnduserver4', 25, 25, 'DU', '310-410', 22); + +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(550,'gnduserver5', 25, 25, 'DU', '310-410', 22); + +INSERT INTO gnbdufunction(gnbduid,gnbduname, gnbid, gnbidlength, nftype, plmnid, nearrtricid) VALUES(660,'gnduserver6', 25, 25, 'DU', '310-410', 22); + --nrcellcu INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15289,'RRC Connected Users','cucpserver1'); @@ -309,63 +323,64 @@ INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14427,'RRC Conne --nrcelldu -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15289,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15289,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',110); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15290,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15290,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',110); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15296,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15296,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',110); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15687,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15687,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',110); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15689,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15689,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',110); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15155,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15155,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',220); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15174,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15174,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',220); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15175,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15175,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',220); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15176,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15176,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',220); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15825,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15825,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',220); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15826,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15826,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',330); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15425,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15425,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',330); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15426,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15426,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',330); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13999,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13999,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',330); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14000,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14000,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',330); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11561,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11561,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',440); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11562,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11562,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',440); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11568,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11568,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',440); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11569,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(11569,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',440); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(10896,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(10896,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',440); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(10897,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(10897,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',550); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14655,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14655,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',550); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14656,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14656,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',550); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13905,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13905,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',550); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13910,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(13910,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',550); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15360,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15360,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',660); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15361,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15361,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',660); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15548,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15548,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',660); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15549,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(15549,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',660); -INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14427,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); +INSERT INTO nrcelldu(celllocalId,resourcetype,administrativestate,cellstate, nrpci, nrtac, operationalstate,gnbduid) VALUES(14427,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',660); +UPDATE nrcelldu SET prb=500; 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()); |