diff options
196 files changed, 15665 insertions, 5761 deletions
diff --git a/ransim/WebContent/META-INF/MANIFEST.MF b/ransim/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/ransim/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
diff --git a/ransim/docker/.env b/ransim/docker/.env deleted file mode 100644 index 0916ff2..0000000 --- a/ransim/docker/.env +++ /dev/null @@ -1,2 +0,0 @@ -PRELOAD_POLICIES=true - diff --git a/ransim/docker/config/db/db.sh b/ransim/docker/config/db/db.sh index 4f988be..4f988be 100644..100755 --- a/ransim/docker/config/db/db.sh +++ b/ransim/docker/config/db/db.sh diff --git a/ransim/docker/config/db/ransim_schema.sql b/ransim/docker/config/db/ransim_schema.sql new file mode 100644 index 0000000..a155a8f --- /dev/null +++ b/ransim/docker/config/db/ransim_schema.sql @@ -0,0 +1,371 @@ +CREATE USER 'uroot'@'%' IDENTIFIED BY 'psecret'; +CREATE SCHEMA IF NOT EXISTS `ransim_db` DEFAULT CHARACTER SET utf8; +USE `ransim_db`; +grant all privileges on ransim_db.* TO 'uroot'@'%' identified by 'psecret'; +flush privileges; +drop table if exists nearrtric; +drop table if exists gnbcucpfunction; +drop table if exists gnbcuupfunction; +drop table if exists gnbdufunction; +drop table if exists nrcellcu; +drop table if exists nrcelldu; +drop table if exists raninventory; +drop table if exists rrmpolicyratio; +drop table if exists rrmpolicymember; +drop table if exists tacells; +drop table if exists sliceprofile; +drop table if exists plmninfo; +drop table if exists trackingarea; +drop table if exists rannfnssi; +drop table if exists nssai; +drop table if exists rannssi; + +-- ----------------------------------------------------- +-- Table `ransim_db`.`cell` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `ransim_db`.`cell`( + `cell_id` varchar(45) NOT NULL, + `last_modifiedts` datetime(6) NOT NULL, + `location` varchar(200) DEFAULT NULL, + `network_id` varchar(45) NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `pci_value` bigint(20) NOT NULL, + `pnf_id` varchar(255) NOT NULL, + PRIMARY KEY (`cell_id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8; +-- ----------------------------------------------------- +-- Table `ransim_db`.`cell_nbr_info` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `ransim_db`.`cell_nbr_info`( + `cell_id` varchar(45) NOT NULL, + `target_cell_id` varchar(45) NOT NULL, + `ho` bit(1) NOT NULL, + PRIMARY KEY (`cell_id`, `target_cell_id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8; +-- Guilin - Slicing Usecase +-- ----------------------------------------------------- +-- Table `ransim_db`.`nearrtric` +-- ----------------------------------------------------- +create table nearrtric ( + nearrtricid integer not null, + gnbid integer, + resourcetype varchar(255), + primary key (nearrtricid) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`trackingarea` +-- ----------------------------------------------------- +create table trackingarea ( + nearrtricid integer not null, + tracking_area varchar(255) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rannfnssi` +-- ----------------------------------------------------- +create table rannfnssi ( + nearrtricid integer not null, + rannfnssilist varchar(255) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`nssai` +-- ----------------------------------------------------- +create table nssai ( + rannfnssiid varchar(255) not null, + nssailist varchar(255) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`gnbcucpfunction` +-- ----------------------------------------------------- +create table gnbcucpfunction ( + gnbcuname varchar(255) not null, + gnbid integer, + gnbidlength integer, + nftype varchar(255), + plmnid varchar(255), + nearrtricid integer, + primary key (gnbcuname) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`gnbcuupfunction` +-- ----------------------------------------------------- +create table gnbcuupfunction ( + gnbcuupid integer not null, + gnbid integer, + gnbidlength integer, + resourcetype varchar(255), + nearrtricid integer, + primary key (gnbcuupid) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`gnbdufunction` +-- ----------------------------------------------------- +create table gnbdufunction ( + gnbduid integer not null, + gnbduname varchar(255), + gnbid integer, + gnbidlength integer, + nftype varchar(255), + plmnid varchar(255), + nearrtricid integer, + primary key (gnbduid) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`nrcellcu` +-- ----------------------------------------------------- +create table nrcellcu ( + celllocalid integer not null, + gnbcuname varchar(255), + resourcetype varchar(255), + primary key (celllocalid) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`nrcelldu` +-- ----------------------------------------------------- +create table nrcelldu ( + celllocalid integer not null, + administrativestate varchar(255), + resourcetype varchar(255), + cellstate varchar(255), + nrpci integer, + nrtac integer, + operationalstate varchar(255), + gnbduid integer, + prb integer, + primary key (celllocalid) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`raninventory` +-- ----------------------------------------------------- +create table raninventory ( + rannfnssiid varchar(255) not null, + isshareable varchar(255), + nsstid varchar(255), + slicetype varchar(255), + subnetstatus varchar(255), + talist varchar(500), + primary key (rannfnssiid) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rannssi` +-- ----------------------------------------------------- +create table rannssi ( + rannfnssiid varchar(255) not null, + rannssilist varchar(255) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rrmpolicyratio` +-- ----------------------------------------------------- +create table rrmpolicyratio ( + rrmpolicyid integer not null, + quotatype varchar(255), + rrmpolicydedicatedratio integer, + rrmpolicymaxratio integer, + rrmpolicyminratio integer, + resourceid varchar(255), + resourcetype varchar(255), + slicetype varchar(255), + primary key (rrmpolicyid) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`rrmpolicymember` +-- ----------------------------------------------------- +create table rrmpolicymember ( + plmnid varchar(255) not null, + snssai varchar(255) not null, + rrm_policy_rrmpolicyid integer, + primary key (plmnid, snssai) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`tacells` +-- ----------------------------------------------------- +create table tacells ( + trackingarea varchar(255) not null, + cells varchar(255), + primary key (trackingarea) +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`plmninfo` +-- ----------------------------------------------------- +create table plmninfo ( + plmnid varchar(255) not null, + globalSubscriberId varchar(255), + snssai varchar(255), + status varchar(255), + subscriptionServiceType varchar(255), + gnbcuupid integer, + nrcellcu_celllocalid integer, + nrcelldu_celllocalid integer, + nearrtricid integer, + uLThptPerSlice integer, + dLThptPerSlice integer, + maxNumberOfConns integer, + lastUpdatedTS TIMESTAMP DEFAULT CURRENT_TIMESTAMP() +) engine = InnoDB; +-- ----------------------------------------------------- +-- Table `ransim_db`.`sliceprofile` +-- ----------------------------------------------------- +create table sliceprofile ( + sliceprofileid varchar(255) not null, + coveragearealist varchar(255), + ulthptperslice integer, + dlthptperslice integer, + latency integer, + maxnumberofconns integer, + maxnoofues integer, + plmnidlist varchar(255), + resourcesharinglevel varchar(255), + snssai varchar(255), + uemobilitylevel varchar(255), + rannfnssiid varchar(255), + primary key (sliceprofileid) +) engine = InnoDB; + +-- ----------------------------------------------------- +--Pre-loaded data +-- ----------------------------------------------------- +-- tacells + +INSERT INTO tacells(trackingarea,cells) VALUES('TA1', '15289,15290,15296,15687,15689,15155,15174,15175'); +INSERT INTO tacells(trackingarea,cells) VALUES('TA2', '15176,15825,15826,15425,15426,13999,14000'); +INSERT INTO tacells(trackingarea,cells) VALUES('TA3', '11561,11562,11568,11569,10896,10897,14655,14656'); +INSERT INTO tacells(trackingarea,cells) VALUES('TA4', '13905,13910,15360,15361,15548,15549,14427'); + +--nearrtric +INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(11, 98763, 'NearRTRIC'); +INSERT INTO nearrtric (nearrtricid, gnbid, resourcetype) VALUES(22, 98763, '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); +--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); +--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); +--nrcellcu +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15289,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15290,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15296,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15687,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15689,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15155,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15174,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15175,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15176,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15825,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15826,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15425,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15426,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(13999,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14000,'RRC Connected Users','cucpserver1'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11561,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11562,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11568,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(11569,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(10896,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(10897,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14655,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14656,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(13905,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(13910,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15360,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15361,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15548,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(15549,'RRC Connected Users','cucpserver2'); + +INSERT INTO nrcellcu(celllocalId,resourcetype,gnbcuname) VALUES(14427,'RRC Connected Users','cucpserver2'); + +--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(15290,'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',1); + +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(15689,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',1); + +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(15174,'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',2); + +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(15825,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',2); + +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(15425,'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',3); + +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(14000,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',3); + +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(11562,'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',4); + +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(10896,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',4); + +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(14655,'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',5); + +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(13910,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',5); + +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(15361,'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',6); + +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(14427,'PRB','UNLOCKED','ACTIVE',12,310,'ENABLED',6); + diff --git a/ransim/docker/config/ransim/gNBCUConfig.json b/ransim/docker/config/ransim/gNBCUConfig.json new file mode 100644 index 0000000..171239f --- /dev/null +++ b/ransim/docker/config/ransim/gNBCUConfig.json @@ -0,0 +1,772 @@ +[ + { + "gNBCUName": "cucpserver1", + "gNBId": 98763, + "gNBIdLength": 32, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 11, + "cellCUList": [ + { + "cellLocalId": 15289, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15290, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15296, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15687, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15689, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15155, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15174, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15175, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15176, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15825, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15826, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15425, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15426, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13999, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14000, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + } + ] + }, + { + "gNBCUName": "cucpserver2", + "gNBId": 98763, + "gNBIdLength": 32, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 22, + "cellCUList": [ + { + "cellLocalId": 11561, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11562, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11568, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11569, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10896, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10897, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14655, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14656, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13905, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13910, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15360, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15361, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15548, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15549, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14427, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + }, + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + } + ] + } +] diff --git a/ransim/docker/config/ransim/gNBCUConfig_1NSSAI.json b/ransim/docker/config/ransim/gNBCUConfig_1NSSAI.json new file mode 100644 index 0000000..1e38eef --- /dev/null +++ b/ransim/docker/config/ransim/gNBCUConfig_1NSSAI.json @@ -0,0 +1,472 @@ +[ + { + "gNBCUName": "cucpserver1", + "gNBId": 98763, + "gNBIdLength": 5, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 11, + "cellCUList": [ + { + "cellLocalId": 15289, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15290, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15296, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15687, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15689, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15155, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15174, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15175, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15176, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15825, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15826, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15425, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 15426, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 13999, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14000, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + } + ] + }, + { + "gNBCUName": "cucpserver2", + "gNBId": 98763, + "gNBIdLength": 5, + "pLMNId": "310-410", + "nFType": "CUCP", + "nearRTRICId": 22, + "cellCUList": [ + { + "cellLocalId": 11561, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11562, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11568, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 11569, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10896, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 10897, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14655, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0011-0010", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 4500 + } + } + } + ] + }, + { + "cellLocalId": 14656, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 13905, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 13910, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15360, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15361, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15548, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 15549, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + }, + { + "cellLocalId": 14427, + "pLMNInfoList": [ + { + "pLMNId": "310-410", + "sNSSAI": { + "sNSSAI": "0010-1110", + "status": "ACTIVE", + "configData": { + "maxNumberOfConns": 6000 + } + } + } + ] + } + ] + } +] diff --git a/ransim/docker/config/ransim/jssecacerts b/ransim/docker/config/ransim/jssecacerts Binary files differnew file mode 100644 index 0000000..2232b4c --- /dev/null +++ b/ransim/docker/config/ransim/jssecacerts diff --git a/ransim/docker/config/ransim/ransim.properties b/ransim/docker/config/ransim/ransim.properties index f6723dc..3be141a 100644 --- a/ransim/docker/config/ransim/ransim.properties +++ b/ransim/docker/config/ransim/ransim.properties @@ -4,10 +4,5 @@ numberOfProcessPerMc=25 numberOfMachines=5 GridSize=1 strictValidateRansimAgentsAvailability=false -sdnrServerIp=10.31.1.79 -sdnrServerPort=30202 -sdnrServerUserid=admin -sdnrServerPassword=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U maxPciValueAllowed=503 -dumpFileName=/tmp/ransim-install/config/latestDump.json diff --git a/ransim/docker/docker-compose.yml b/ransim/docker/docker-compose.yml index eb9b776..6c5c2ba 100644 --- a/ransim/docker/docker-compose.yml +++ b/ransim/docker/docker-compose.yml @@ -3,7 +3,7 @@ networks: default: driver: bridge driver_opts: - com.docker.network.driver.mtu: ${MTU} + com.docker.network.driver.mtu: 1400 services: mariadb: image: 'mariadb:10.0.34' @@ -20,9 +20,15 @@ services: ransim: image: 'onap/ransim:1.0.0-SNAPSHOT' container_name: ransim - hostname: ransimsvr + environment: + - SDNR_IP=10.31.4.51 + - SDNR_PORT=30267 + - SDNR_USER=admin + - SDNR_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + hostname: ransim ports: - '8081:8081' command: ransim volumes: - './config/ransim:/tmp/ransim-install/config' + - './config/ransim/jssecacerts:/tmp/cert/jssecacerts' diff --git a/ransim/docker/ransim-docker/Dockerfile b/ransim/docker/ransim-docker/Dockerfile index a576c92..b139fef 100644 --- a/ransim/docker/ransim-docker/Dockerfile +++ b/ransim/docker/ransim-docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04 +FROM ubuntu:18.04 ARG HTTP_PROXY=${HTTP_PROXY} ARG HTTPS_PROXY=${HTTPS_PROXY} @@ -7,26 +7,27 @@ ENV http_proxy $HTTP_PROXY ENV https_proxy $HTTPS_PROXY RUN \ - apt-get clean && \ - apt-get update && \ - apt-get install -y zip unzip curl wget ssh telnet maven && \ - apt-get install -y software-properties-common && \ - apt-get install -y jq httpie && \ - apt-get install -y python-pip && \ - add-apt-repository ppa:openjdk-r/ppa && \ - apt-get clean && \ - apt-get update && \ - apt-get install -y openjdk-8-jdk +apt-get clean && \ +apt-get update && \ +apt-get install -y zip unzip curl wget ssh telnet maven && \ +apt-get install -y software-properties-common && \ +apt-get install -y jq httpie && \ +apt-get install -y python-pip && \ +apt-get install -y vim && \ +add-apt-repository ppa:openjdk-r/ppa && \ +apt-get clean && \ +apt-get update && \ +apt-get install -y openjdk-8-jdk RUN useradd --create-home --shell /bin/bash policy RUN \ apt-get install -y apt-transport-https && \ - apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db && \ - add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main' && \ - apt-get clean && \ - apt-get update && \ - apt-get install -y mariadb-client +apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 && \ +add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main' && \ +apt-get clean && \ +apt-get update && \ +apt-get install -y mariadb-client RUN mkdir -p /opt/app/policy /tmp/ransim-install && chown policy /opt/app/policy /tmp/ransim-install @@ -39,3 +40,5 @@ USER policy ENTRYPOINT [ "bash", "./do-start.sh" ] + + diff --git a/ransim/docker/ransim-docker/do-start.sh b/ransim/docker/ransim-docker/do-start.sh index ec1f601..ec1f601 100644..100755 --- a/ransim/docker/ransim-docker/do-start.sh +++ b/ransim/docker/ransim-docker/do-start.sh diff --git a/ransim/docker/ransim-docker/docker-install.sh b/ransim/docker/ransim-docker/docker-install.sh index cbfe0b1..cbfe0b1 100644..100755 --- a/ransim/docker/ransim-docker/docker-install.sh +++ b/ransim/docker/ransim-docker/docker-install.sh diff --git a/ransim/docker/ransim-docker/wait-for-port.sh b/ransim/docker/ransim-docker/wait-for-port.sh index 10f08de..10f08de 100644..100755 --- a/ransim/docker/ransim-docker/wait-for-port.sh +++ b/ransim/docker/ransim-docker/wait-for-port.sh diff --git a/ransim/pom.xml b/ransim/pom.xml index 0c7d0cc..e0ebf7b 100644 --- a/ransim/pom.xml +++ b/ransim/pom.xml @@ -19,6 +19,11 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.oparent</groupId> + <artifactId>oparent</artifactId> + <version>2.1.0</version> + </parent> <groupId>org.onap.ransim</groupId> <artifactId>ransim</artifactId> <packaging>pom</packaging> @@ -32,7 +37,6 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> - <java.version>1.8</java.version> <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry> <docker.push.registry>nexus3.onap.org:10003</docker.push.registry> @@ -242,6 +246,5 @@ </plugins> </pluginManagement> </build> - </project> diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore b/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore index b83d222..0f63015 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore +++ b/ransim/ransimctrlr/RANSIM-CTRLR/.gitignore @@ -1 +1,2 @@ /target/ +/bin/ diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml b/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml index cacf31f..6f55e2c 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml +++ b/ransim/ransimctrlr/RANSIM-CTRLR/pom.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="UTF-8"?><!-- ============LICENSE_START======================================================= Ran Simulator Controller ================================================================================ @@ -20,8 +19,7 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -30,9 +28,11 @@ <version>1.0.0-SNAPSHOT</version> </parent> + <artifactId>RANSIM-CTRLR</artifactId> <description>RANSIM CTRLR</description> <properties> + <springboot.version>2.2.4.RELEASE</springboot.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <springframework.version>4.3.3.RELEASE</springframework.version> <eclipselink.version>2.6.0</eclipselink.version> @@ -57,46 +57,33 @@ <artifactId>jetty-maven-plugin</artifactId> <version>${jetty.version}</version> </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <version>2.17</version> - <configuration> - <skip>true</skip> - <includes>**/org/openecomp/**/*.java</includes> - <configLocation>/google_checks.xml</configLocation> - </configuration> - </plugin> - - <plugin> - <groupId>org.eclipse.m2e</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>1.0.0</version> - <configuration> - <lifecycleMappingMetadata> - <pluginExecutions> - <pluginExecution> - <pluginExecutionFilter> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <versionRange>2.17,)</versionRange> - <goals> - <goal>check</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore /> - </action> - </pluginExecution> - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>2.3.1.RELEASE</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> <dependencies> <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.5.6</version> + <exclusions> + <exclusion> + <artifactId>commons-logging</artifactId> + <groupId>commons-logging</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>javax.persistence</artifactId> <version>${javax.persistence.version}</version> @@ -131,12 +118,6 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.3</version> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>log4j</groupId> @@ -144,16 +125,6 @@ <version>1.2.17</version> </dependency> <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.4</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>19.0</version> - </dependency> - <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version>2.1.1</version> @@ -165,17 +136,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.awaitility</groupId> - <artifactId>awaitility</artifactId> - <version>3.0.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <version>2.3.2</version> - </dependency> - <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.18</version> @@ -192,12 +152,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>javax.websocket</groupId> - <artifactId>javax.websocket-api</artifactId> - <version>1.1</version> - <scope>provided</scope> - </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.9.5</version> @@ -223,36 +177,16 @@ <version>1.5.6</version> </dependency> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${springframework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>${springframework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>${springframework.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - <version>${version.org.hibernate}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-testing</artifactId> - <version>${version.org.hibernate}</version> - </dependency> - <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.6.2</version> </dependency> <dependency> + <groupId>org.onosproject</groupId> + <artifactId>jnc</artifactId> + <version>1.0</version> + </dependency> + <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.5.0</version> @@ -276,5 +210,65 @@ </exclusion> </exclusions> </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + <version>${springboot.version}</version> + + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <version>${springboot.version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-webflux</artifactId> + <version>${springboot.version}</version> + + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.modelmapper</groupId> + <artifactId>modelmapper</artifactId> + <version>2.3.8</version> + </dependency> + <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>1.1.1</version> + </dependency> + </dependencies> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${springboot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> </project> + diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/Application.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/Application.java new file mode 100644 index 0000000..4bbd401 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/Application.java @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/RansimDbConfig.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/RansimDbConfig.java new file mode 100644 index 0000000..029e182 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/RansimDbConfig.java @@ -0,0 +1,95 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim; + +import java.util.HashMap; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +@Configuration +@PropertySource({"classpath:application.properties"}) +@EnableJpaRepositories( + basePackages = "org.onap.ransim.rest.api.repository" + "", + entityManagerFactoryRef = "entityManager", + transactionManagerRef = "transactionManager") +@ComponentScan(basePackages = "org.onap.ransim") +public class RansimDbConfig { + + @Autowired + Environment env; + + @Bean + @Primary + LocalContainerEntityManagerFactoryBean entityManager() { + LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setPackagesToScan("org.onap.ransim.rest.api.models"); + em.setDataSource(dataSource()); + HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + HashMap<String, Object> properties = new HashMap<>(); + properties.put("hibernate.hbm2ddl.auto", env.getProperty("spring.jpa.hibernate.ddl-auto")); + properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); + em.setJpaPropertyMap(properties); + return em; + } + + /** + * User data source Bean. + */ + @Primary + @Bean + public DataSource dataSource() { + + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(env.getProperty("spring.datasource.driver-class-name")); + dataSource.setUrl(env.getProperty("spring.datasource.url")); + dataSource.setUsername(env.getProperty("spring.datasource.username")); + dataSource.setPassword(env.getProperty("spring.datasource.password")); + + return dataSource; + } + + /** + * User Transaction Manager Bean. + */ + @Primary + @Bean + public PlatformTransactionManager transactionManager() { + JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManager().getObject()); + return transactionManager; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/ServletInitializer.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/ServletInitializer.java new file mode 100644 index 0000000..68be82a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/ServletInitializer.java @@ -0,0 +1,33 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(Application.class); + } + +} 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 new file mode 100644 index 0000000..f4dc174 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java @@ -0,0 +1,239 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.netconf; + +import com.tailf.jnc.Device; +import com.tailf.jnc.DeviceUser; +import com.tailf.jnc.Element; +import com.tailf.jnc.JNCException; +import com.tailf.jnc.NetconfSession; + +import java.io.IOException; +import java.net.ConnectException; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.web.mapper.GNBCUCPModel; +import org.onap.ransim.rest.web.mapper.GNBCUUPModel; +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; + +public class NetconfClient { + + static Logger log = Logger.getLogger(NetconfClient.class.getName()); + + private String emsUserName; + private Device device; + + public NetconfClient(Device device) { + this.device = device; + } + + public NetconfClient(String emsUserName, String username, String password, String serverName, String ip, int port) { + DeviceUser deviceUser = new DeviceUser(emsUserName, username, password); + this.emsUserName = emsUserName; + this.device = new Device(serverName, deviceUser, ip, port); + } + + public Element getInitialNodeSet(NearRTRICModel rtRicModel, String serverId) { + try { + + 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(rtRicModel.getNearRTRICId()); + Element sapElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/sAP"); + Element hostElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/host"); + hostElement.setValue("localhost"); + Element portElement = Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/port"); + portElement.setValue("8080"); + sapElement.addChild(hostElement); + sapElement.addChild(portElement); + + for (GNBCUUPModel gNBCUUPModel : rtRicModel.getgNBCUUPList()) { + if (gNBCUUPModel.getgNBCUUPId().toString().equals(serverId) + || rtRicModel.getNearRTRICId().toString().equals(serverId)) { + Element gNBCUUPFunctionElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/GNBCUUPFunction"); + Element idGNBCUUPFunctionElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/idGNBCUUPFunction"); + idGNBCUUPFunctionElement.setValue(gNBCUUPModel.getgNBCUUPId().toString()); + Element attributesElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes"); + Element gnBIdElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBId"); + gnBIdElement.setValue(gNBCUUPModel.getgNBId()); + attributesElement.addChild(gnBIdElement); + attributesElement.addChild(sapElement); + gNBCUUPFunctionElement.addChild(idGNBCUUPFunctionElement); + gNBCUUPFunctionElement.addChild(attributesElement); + nearRTRICElement.addChild(gNBCUUPFunctionElement); + } + } + for (GNBCUCPModel gNBCUCPModel : rtRicModel.getgNBCUCPList()) { + if (gNBCUCPModel.getgNBCUName().equals(serverId) + || rtRicModel.getNearRTRICId().toString().equals(serverId)) { + Element gNBCUCPFunctionElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/GNBCUCPFunction"); + Element idGNBCUCPFunctionElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/idGNBCUCPFunction"); + idGNBCUCPFunctionElement.setValue(gNBCUCPModel.getgNBCUName()); + Element attributesElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes"); + Element gNBCUNameElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBCUName"); + gNBCUNameElement.setValue(gNBCUCPModel.getgNBCUName()); + Element gnBIdElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBId"); + gnBIdElement.setValue(gNBCUCPModel.getgNBId()); + Element gNBIdLengthElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBIdLength"); + gNBIdLengthElement.setValue(gNBCUCPModel.getgNBIdLength()); + attributesElement.addChild(gNBCUNameElement); + attributesElement.addChild(gnBIdElement); + attributesElement.addChild(gNBIdLengthElement); + attributesElement.addChild(sapElement); + for (NRCellCUModel nRCellCUModel : gNBCUCPModel.getCellCUList()) { + Element nRCellCUElement = + 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(nRCellCUModel.getCellLocalId()); + Element nRCellattributesElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes"); + Element cellLocalIdElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/cellLocalId"); + cellLocalIdElement.setValue(nRCellCUModel.getCellLocalId()); + nRCellattributesElement.addChild(cellLocalIdElement); + nRCellattributesElement.addChild(sapElement); + nRCellCUElement.addChild(idNRCellCUElement); + nRCellCUElement.addChild(nRCellattributesElement); + gNBCUCPFunctionElement.addChild(nRCellCUElement); + } + gNBCUCPFunctionElement.addChild(idGNBCUCPFunctionElement); + gNBCUCPFunctionElement.addChild(attributesElement); + nearRTRICElement.addChild(gNBCUCPFunctionElement); + } + } + for (GNBDUModel gNBDUModel : rtRicModel.getgNBDUList()) { + if (gNBDUModel.getgNBDUId().toString().equals(serverId) + || rtRicModel.getNearRTRICId().toString().equals(serverId)) { + 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(gNBDUModel.getgNBDUId()); + Element attributesElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes"); + Element gNBDUNameElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBDUName"); + gNBDUNameElement.setValue(gNBDUModel.getgNBDUName()); + Element gNBIdLengthElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBIdLength"); + gNBIdLengthElement.setValue(gNBDUModel.getgNBIdLength()); + Element gNBDUIdElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBDUId"); + gNBDUIdElement.setValue(gNBDUModel.getgNBDUId()); + attributesElement.addChild(gNBIdLengthElement); + attributesElement.addChild(gNBDUNameElement); + attributesElement.addChild(gNBDUIdElement); + attributesElement.addChild(sapElement); + for (NRCellDUModel nRCellDUModel : gNBDUModel.getCellDUList()) { + 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(nRCellDUModel.getCellLocalId()); + Element nRCellattributesElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes"); + Element cellLocalIdElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/cellLocalId"); + cellLocalIdElement.setValue(nRCellDUModel.getCellLocalId()); + Element nRSectorCarrierRefElement = Element + .create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/nRSectorCarrierRef"); + nRSectorCarrierRefElement.setValue("OU=Sales"); + Element administrativeStateElement = Element + .create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/administrativeState"); + administrativeStateElement.setValue(nRCellDUModel.getAdministrativeState()); + Element nRPCIElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/nRPCI"); + nRPCIElement.setValue(nRCellDUModel.getnRPCI()); + Element nRTACElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/nRTAC"); + nRTACElement.setValue(nRCellDUModel.getnRTAC()); + nRCellattributesElement.addChild(cellLocalIdElement); + nRCellattributesElement.addChild(sapElement); + nRCellattributesElement.addChild(nRSectorCarrierRefElement); + nRCellattributesElement.addChild(administrativeStateElement); + nRCellattributesElement.addChild(nRPCIElement); + nRCellattributesElement.addChild(nRTACElement); + nRCellDUElement.addChild(idNRCellDUElement); + nRCellDUElement.addChild(nRCellattributesElement); + gNBDUFunctionElement.addChild(nRCellDUElement); + } + gNBDUFunctionElement.addChild(idGNBDUFunctionElement); + gNBDUFunctionElement.addChild(attributesElement); + nearRTRICElement.addChild(gNBDUFunctionElement); + } + } + + nearRTRICElement.addChild(idNearRTRICElement); + ranNetworkElement.addChild(nearRTRICElement); + + return ranNetworkElement; + + } catch (JNCException e) { + log.error("Exception occured during NodeSet creation {}", e); + return null; + } + + } + + public void editConfig(Element initialConfig) { + try { + Boolean connected = false; + while (!connected) { + try { + Thread.sleep(6000); + device.connect(emsUserName); + connected = true; + } catch (ConnectException e) { + log.error("Device is not up yet... retrying after 3s"); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + } + + } + + device.newSession("cfg"); + log.info(initialConfig.toXMLString()); + device.getSession("cfg").editConfig(NetconfSession.CANDIDATE, initialConfig); + device.getSession("cfg").commit(); + log.info("Initial configuration set"); + } catch (IOException | JNCException e) { + log.error("Exception occured during edit config {}", e); + } + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/FileController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/FileController.java new file mode 100644 index 0000000..905df8a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/FileController.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.controller; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +@Controller +@RequestMapping("/file") +@CrossOrigin(origins = "*") +@Configuration +@PropertySource(value = "classpath:dumpfileNames.properties") +public class FileController { + + static Logger log = Logger.getLogger(FileController.class.getName()); + + private static final String fileBasePath = "/tmp/ransim-install/config/"; + + @Value("${defaultFiles:}") + List<String> fileList = new ArrayList<>(); + + /** + * Method to upload dump file + * + * @param file + * @return + */ + @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public ResponseEntity<String> uploadToLocalFileSystem(@RequestParam("file") MultipartFile file) { + String fileName = StringUtils.cleanPath(file.getOriginalFilename()); + Path path = Paths.get(fileBasePath + fileName); + try { + Files.copy(file.getInputStream(), path, StandardCopyOption.REPLACE_EXISTING); + fileList.add(fileName); + log.info("File downloaded in " + fileBasePath + fileName); + } catch (IOException e) { + log.error(e); + } + log.info("Copied in path : " + path); + return ResponseEntity.ok("Uploaded successfully"); + } + + /** + * Method to retrieve list of available dump files + * + * @return + */ + @GetMapping(value = "/dumpfiles", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity<List<String>> getFiles() { + return ResponseEntity.ok(fileList); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RANSliceConfigController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RANSliceConfigController.java new file mode 100644 index 0000000..b6a661d --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RANSliceConfigController.java @@ -0,0 +1,616 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.controller; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.web.mapper.GNBCUCPModel; +import org.onap.ransim.rest.web.mapper.GNBCUUPModel; +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.rest.web.mapper.RANSliceInfoModel; +import org.onap.ransim.rest.web.mapper.RRMPolicyRatioModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(path = "/api/ransim-db/v4") +public class RANSliceConfigController { + private static final Logger logger = LoggerFactory.getLogger(RANSliceConfigController.class); + + @Autowired + private RANSliceConfigService ranSliceConfigService; + + // SDN-R APIs + /** + * This method updates the slice details, config details of CUCP + * + * @param GNBCUCPModel + * @return ResponseEntity<GNBCUCPModel> + */ + @PutMapping(path = "/gNBCUCP") + public ResponseEntity<GNBCUCPModel> updateGNBCUCPFunction(@RequestBody GNBCUCPModel gNBCUCPModel) { + logger.info("Request Received"); + try { + return new ResponseEntity<GNBCUCPModel>(ranSliceConfigService.saveGNBCUCP(gNBCUCPModel), HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating GNBCUCP:" + e.getMessage()); + return new ResponseEntity<GNBCUCPModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the CUCP details + * + * @param gNBCUCPName + * @return ResponseEntity<GNBCUCPModel> + */ + @GetMapping(path = "/gNBCUCP/{gNBCUCPName}") + public ResponseEntity<GNBCUCPModel> findGNBCUCPFunction(@PathVariable String gNBCUCPName) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchGNBCUCPData(gNBCUCPName) != null) { + return new ResponseEntity<GNBCUCPModel>(ranSliceConfigService.fetchGNBCUCPData(gNBCUCPName), + HttpStatus.OK); + } else { + return new ResponseEntity<GNBCUCPModel>(ranSliceConfigService.fetchGNBCUCPData(gNBCUCPName), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching GNBCUCP:" + e.getMessage()); + return new ResponseEntity<GNBCUCPModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the slice details, config details of CUUP + * + * @param GNBCUUPModel + * @return ResponseEntity<GNBCUUPModel> + */ + @PutMapping(path = "/gNBCUUP") + public ResponseEntity<GNBCUUPModel> updateGNBCUUPFunction(@RequestBody GNBCUUPModel gNBCUUPModel) { + logger.info("Request Received"); + try { + return new ResponseEntity<GNBCUUPModel>(ranSliceConfigService.saveGNBCUUP(gNBCUUPModel), HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating GNBCUUP:" + e.getMessage()); + return new ResponseEntity<GNBCUUPModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the CUCP details + * + * @param gNBCUCPName + * @return ResponseEntity<GNBCUCPModel> + */ + @GetMapping(path = "/gNBCUUP/{gNBCUUPId}") + public ResponseEntity<GNBCUUPModel> findGNBCUUPFunction(@PathVariable Integer gNBCUUPId) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchGNBCUUPData(gNBCUUPId) != null) { + return new ResponseEntity<GNBCUUPModel>(ranSliceConfigService.fetchGNBCUUPData(gNBCUUPId), + HttpStatus.OK); + } else { + return new ResponseEntity<GNBCUUPModel>(ranSliceConfigService.fetchGNBCUUPData(gNBCUUPId), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching GNBCUCP:" + e.getMessage()); + return new ResponseEntity<GNBCUUPModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the slice details, config details of gNBDU + * + * @param GNBDUModel + * @return ResponseEntity<GNBDUModel> + */ + @PutMapping(path = "/gNBDU") + public ResponseEntity<GNBDUModel> updateGNBDUFunction(@RequestBody GNBDUModel gNBDUModel) { + logger.info("Request Received"); + try { + return new ResponseEntity<GNBDUModel>(ranSliceConfigService.saveGNBDU(gNBDUModel), HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating GNBDU:" + e.getMessage()); + return new ResponseEntity<GNBDUModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the gNBDU details + * + * @param gNBDUId + * @return ResponseEntity<GNBDUModel> + */ + @GetMapping(path = "/gNBDU/{gNBDUId}") + public ResponseEntity<GNBDUModel> findGNBDUFunction(@PathVariable Integer gNBDUId) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchGNBDUData(gNBDUId) != null) { + return new ResponseEntity<GNBDUModel>(ranSliceConfigService.fetchGNBDUData(gNBDUId), HttpStatus.OK); + } else { + return new ResponseEntity<GNBDUModel>(ranSliceConfigService.fetchGNBDUData(gNBDUId), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching GNBDU:" + e.getMessage()); + return new ResponseEntity<GNBDUModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the NearRTRIC details + * + * @param nearRTRICModel + * @return ResponseEntity<NearRTRICModel> + */ + @PutMapping(path = "/nearRTRIC") + public ResponseEntity<NearRTRICModel> updateNearRTRIC(@RequestBody NearRTRICModel nearRTRICModel) { + logger.info("Request Received"); + try { + return new ResponseEntity<NearRTRICModel>(ranSliceConfigService.saveNearRTRIC(nearRTRICModel), + HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating nearRTRIC:" + e.getMessage()); + return new ResponseEntity<NearRTRICModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the nearRTRIC details + * + * @param nearRTRICId + * @return ResponseEntity<GNBDUModel> + */ + @GetMapping(path = "/nearRTRIC/{nearRTRICId}") + public ResponseEntity<NearRTRICModel> findNearRTRICFunction(@PathVariable Integer nearRTRICId) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchNearRTRICData(nearRTRICId) != null) { + return new ResponseEntity<NearRTRICModel>(ranSliceConfigService.fetchNearRTRICData(nearRTRICId), + HttpStatus.OK); + } else { + return new ResponseEntity<NearRTRICModel>(ranSliceConfigService.fetchNearRTRICData(nearRTRICId), + HttpStatus.NO_CONTENT); + } + + } catch (Exception e) { + logger.error("Error while fetching nearRTRIC:" + e.getMessage()); + return new ResponseEntity<NearRTRICModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the RRMPolicy of CU/DU + * + * @param resourceType + * @param resourceId + * @return + */ + @GetMapping(path = "/rrmPolicy/{resourceType}/{resourceId}") + public ResponseEntity<RRMPolicyRatioModel> findRRMPolicyOfNE(@PathVariable String resourceType, + @PathVariable String resourceId) { + logger.debug("Request Received"); + try { + if (ranSliceConfigService.fetchRRMPolicyOfNE(resourceType, resourceId) != null) { + return new ResponseEntity<RRMPolicyRatioModel>( + ranSliceConfigService.fetchRRMPolicyOfNE(resourceType, resourceId), HttpStatus.OK); + } else { + return new ResponseEntity<RRMPolicyRatioModel>( + ranSliceConfigService.fetchRRMPolicyOfNE(resourceType, resourceId), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching RRMPolicy:" + e.getMessage()); + return new ResponseEntity<RRMPolicyRatioModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * This method updates the RRM policy of a network function + * + * @param nearRTRICModel + * @return ResponseEntity<NearRTRICModel> + */ + @PostMapping(path = "/rrmPolicy") + public ResponseEntity<RRMPolicyRatioModel> updateRRMPolicy(@RequestBody RRMPolicyRatioModel rrmPolicy) { + logger.info("Request Received"); + try { + return new ResponseEntity<RRMPolicyRatioModel>(ranSliceConfigService.updateRRMPolicy(rrmPolicy), + HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating RRM Policy:" + e.getMessage()); + return new ResponseEntity<RRMPolicyRatioModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the list of RICs from tracking area + * 1. Find Cells from TA + * 2. find List of RICs of the cells + * + * @param trackingArea + * @return + */ + @GetMapping(path = "/nearrtric-list/{trackingArea}") + public ResponseEntity<List<NearRTRICModel>> findNearRTRICofCellsFromTA(@PathVariable String trackingArea) { + logger.info("Request Received"); + try { + List<String> cellIds = this.findListOfCells(trackingArea).getBody(); + List<Integer> cellIdList = cellIds.stream().map(Integer::parseInt).collect(Collectors.toList()); + if (ranSliceConfigService.findNearRTRICofCells(cellIdList).size() > 0) { + return new ResponseEntity<List<NearRTRICModel>>(ranSliceConfigService.findNearRTRICofCells(cellIdList), + HttpStatus.OK); + } else { + return new ResponseEntity<List<NearRTRICModel>>(ranSliceConfigService.findNearRTRICofCells(cellIdList), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the RICs:" + e.getMessage()); + return new ResponseEntity<List<NearRTRICModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the list of CUs in a tracking area + * + * @param trackingArea + * @return + */ + @GetMapping(path = "/cell-list/{trackingArea}") + public ResponseEntity<List<String>> findListOfCells(@PathVariable String trackingArea) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchCellsofTA(trackingArea).size() > 0) { + return new ResponseEntity<List<String>>(ranSliceConfigService.fetchCellsofTA(trackingArea), + HttpStatus.OK); + } else { + return new ResponseEntity<List<String>>(ranSliceConfigService.fetchCellsofTA(trackingArea), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the Cells:" + e.getMessage()); + return new ResponseEntity<List<String>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the list of CU-Cells + * + * @param nearRTRICId + * @return + */ + @GetMapping(path = "/cu-cell-list/{nearRTRICId}") + public ResponseEntity<List<NRCellCUModel>> findCUCellsofRIC(@PathVariable Integer nearRTRICId) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchCUCellsofRIC(nearRTRICId).size() > 0) { + return new ResponseEntity<List<NRCellCUModel>>(ranSliceConfigService.fetchCUCellsofRIC(nearRTRICId), + HttpStatus.OK); + } else { + return new ResponseEntity<List<NRCellCUModel>>(ranSliceConfigService.fetchCUCellsofRIC(nearRTRICId), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the Cells-CU:" + e.getMessage()); + return new ResponseEntity<List<NRCellCUModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the nearRTRIC of NSSI + * + * This API can be used in Terminate/activate/deactivate to find the RIC from ranNFNSSIId in SO request + * + * @param ranNFNSSIId + * @return List<NearRTRICModel> + */ + @GetMapping(path = "/nearrtric/{ranNFNSSIId}") + public ResponseEntity<List<NearRTRICModel>> findNearRTRICByNSSI(@PathVariable String ranNFNSSIId) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.findNearRTRICByNSSI(ranNFNSSIId).size() > 0) { + return new ResponseEntity<List<NearRTRICModel>>(ranSliceConfigService.findNearRTRICByNSSI(ranNFNSSIId), + HttpStatus.OK); + } else { + return new ResponseEntity<List<NearRTRICModel>>(ranSliceConfigService.findNearRTRICByNSSI(ranNFNSSIId), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the nearRTRIC by RANNFNSSI:" + e.getMessage()); + return new ResponseEntity<List<NearRTRICModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To find the list of DU-Cells + * + * @param nearRTRICId + * @return + */ + @GetMapping(path = "/du-cell-list/{sNSSAI}") + public ResponseEntity<Map<Integer, List<NRCellDUModel>>> findDUCellsofRIC(@PathVariable String sNSSAI) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchDUCellsofRIC(sNSSAI).size() > 0) { + return new ResponseEntity<Map<Integer, List<NRCellDUModel>>>( + ranSliceConfigService.fetchDUCellsofRIC(sNSSAI), HttpStatus.OK); + } else { + return new ResponseEntity<Map<Integer, List<NRCellDUModel>>>( + ranSliceConfigService.fetchDUCellsofRIC(sNSSAI), HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the Cells-DU:" + e.getMessage()); + return new ResponseEntity<Map<Integer, List<NRCellDUModel>>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + // Inventory APIs + /** + * This method updates the RAN slice details + * + * @param ranSliceInfoModel + * @return ResponseEntity<RANSliceInfoModel> + */ + @PutMapping(path = "/ranslice-details") + public ResponseEntity<RANSliceInfoModel> updateRANInventory(@RequestBody RANSliceInfoModel ranSliceInfoModel) { + logger.info("Request Received"); + try { + return new ResponseEntity<RANSliceInfoModel>(ranSliceConfigService.updateRANInventory(ranSliceInfoModel), + HttpStatus.OK); + } catch (Exception e) { + logger.error("Error while updating RAN Inventory:" + e.getMessage()); + return new ResponseEntity<RANSliceInfoModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the RAN slice Details + * + * @param ranNFNSSIId + * @return RANSliceInfoModel + */ + @GetMapping(path = "/ranslice-details/{ranNFNSSIId}") + public ResponseEntity<RANSliceInfoModel> findRANSlice(@PathVariable String ranNFNSSIId) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.fetchRANSlice(ranNFNSSIId) != null) { + return new ResponseEntity<RANSliceInfoModel>(ranSliceConfigService.fetchRANSlice(ranNFNSSIId), + HttpStatus.OK); + } else { + return new ResponseEntity<RANSliceInfoModel>(ranSliceConfigService.fetchRANSlice(ranNFNSSIId), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the RAN slice Details:" + e.getMessage()); + return new ResponseEntity<RANSliceInfoModel>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + // Slice Analysis MS APIs + /** + * To fetch The NearRTRICs serving the sNSSAI + * + * @param sNSSAI + * @return List<NearRTRICModel> + */ + @GetMapping(path = "/nearrtric/snssai/{sNSSAI}") + public ResponseEntity<List<NearRTRICModel>> findRICsofNSSAI(@PathVariable String sNSSAI) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.findRICsByNSSAI(sNSSAI).size() > 0) { + return new ResponseEntity<List<NearRTRICModel>>(ranSliceConfigService.findRICsByNSSAI(sNSSAI), + HttpStatus.OK); + } else { + return new ResponseEntity<List<NearRTRICModel>>(ranSliceConfigService.findRICsByNSSAI(sNSSAI), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the nearRTRIC by sNSSAI:" + e.getMessage()); + return new ResponseEntity<List<NearRTRICModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the configuration requested for a slice + * + * @param sNSSAI + * @return + */ + @GetMapping(path = "/profile-config/{sNSSAI}") + public ResponseEntity<Map<String, Integer>> fetchSliceProfileConfiguration(@PathVariable String sNSSAI) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.findSliceProfileconfig(sNSSAI).size() > 0) { + return new ResponseEntity<Map<String, Integer>>(ranSliceConfigService.findSliceProfileconfig(sNSSAI), + HttpStatus.OK); + } else { + return new ResponseEntity<Map<String, Integer>>(ranSliceConfigService.findSliceProfileconfig(sNSSAI), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the Requested Configuration:" + e.getMessage()); + return new ResponseEntity<Map<String, Integer>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the configuration of a slice in RIC + * + * @param sNSSAI + * @return + */ + @GetMapping(path = "/slice-config/{sNSSAI}") + public ResponseEntity<Map<Integer, NSSAIConfig>> fetchSliceConfiguration(@PathVariable String sNSSAI) { + logger.info("Request Received"); + try { + if (ranSliceConfigService.findSliceConfig(sNSSAI).size() > 0) { + return new ResponseEntity<Map<Integer, NSSAIConfig>>(ranSliceConfigService.findSliceConfig(sNSSAI), + HttpStatus.OK); + } else { + return new ResponseEntity<Map<Integer, NSSAIConfig>>(ranSliceConfigService.findSliceConfig(sNSSAI), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the Configuration of a Slice at RIC:" + e.getMessage()); + return new ResponseEntity<Map<Integer, NSSAIConfig>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the DU details + * + * @param + * @return List<GNBDUModel> + */ + @GetMapping(path = "/du-list/{sNSSAI}") + public ResponseEntity<List<GNBDUModel>> fetchDUFunctionsOfNSSAI(@PathVariable String sNSSAI) { + logger.info("Request Received::" + sNSSAI); + try { + if (ranSliceConfigService.findDUsofSNssai(sNSSAI).size() > 0) { + return new ResponseEntity<List<GNBDUModel>>(ranSliceConfigService.findDUsofSNssai(sNSSAI), + HttpStatus.OK); + } else { + return new ResponseEntity<List<GNBDUModel>>(ranSliceConfigService.findDUsofSNssai(sNSSAI), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("Error while fetching the DU details of NSSAI:" + e.getMessage()); + return new ResponseEntity<List<GNBDUModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the DU details + * + * @param + * @return List<GNBDUModel> + */ + @GetMapping(path = "/cucp-list/{sNSSAI}") + public ResponseEntity<List<GNBCUCPModel>> fetchCUFunctionsOfNSSAI(@PathVariable String sNSSAI) { + logger.info("Request Received::" + sNSSAI); + try { + if (ranSliceConfigService.findDUsofSNssai(sNSSAI).size() > 0) { + return new ResponseEntity<List<GNBCUCPModel>>(ranSliceConfigService.findCUsofSNssai(sNSSAI), + HttpStatus.OK); + } else { + return new ResponseEntity<List<GNBCUCPModel>>(ranSliceConfigService.findCUsofSNssai(sNSSAI), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the CU details of NSSAI:" + e.getMessage()); + return new ResponseEntity<List<GNBCUCPModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the Customer Details + * + * @param + * @return Map<String, String> + */ + @GetMapping(path = "/subscriber-details/{sNSSAI}") + public ResponseEntity<Map<String, String>> fetchSubsciberDetailsOfNSSAI(@PathVariable String sNSSAI) { + logger.info("Request Received::" + sNSSAI); + try { + if (ranSliceConfigService.getSubscriberDetails(sNSSAI).size() > 0) { + return new ResponseEntity<Map<String, String>>(ranSliceConfigService.getSubscriberDetails(sNSSAI), + HttpStatus.OK); + } else { + return new ResponseEntity<Map<String, String>>(ranSliceConfigService.getSubscriberDetails(sNSSAI), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the Customer details of NSSAI:" + e.getMessage()); + return new ResponseEntity<Map<String, String>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the cu details + * + * @param + * @return List<GNBCUCPModel> + */ + @GetMapping(path = "/cucp-list") + public ResponseEntity<List<GNBCUCPModel>> fetchCUCPFunctions() { + logger.info("Request Received"); + try { + if (ranSliceConfigService.findAllCUCPFunctions().size() > 0) { + return new ResponseEntity<List<GNBCUCPModel>>(ranSliceConfigService.findAllCUCPFunctions(), + HttpStatus.OK); + } else { + return new ResponseEntity<List<GNBCUCPModel>>(ranSliceConfigService.findAllCUCPFunctions(), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the CU details:" + e.getMessage()); + return new ResponseEntity<List<GNBCUCPModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * To fetch the DU details + * + * @param + * @return List<GNBDUModel> + */ + @GetMapping(path = "/du-list") + public ResponseEntity<List<GNBDUModel>> fetchDUFunctions() { + logger.info("Request Received"); + try { + if (ranSliceConfigService.findAllDUFunctions().size() > 0) { + return new ResponseEntity<List<GNBDUModel>>(ranSliceConfigService.findAllDUFunctions(), HttpStatus.OK); + } else { + return new ResponseEntity<List<GNBDUModel>>(ranSliceConfigService.findAllDUFunctions(), + HttpStatus.NO_CONTENT); + } + } catch (Exception e) { + logger.error("Error while fetching the DU details:" + e.getMessage()); + return new ResponseEntity<List<GNBDUModel>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java index 9ea789e..5a26336 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimController.java @@ -21,1130 +21,760 @@ package org.onap.ransim.rest.api.controller; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; -import java.util.Collections; +import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Properties; -import java.util.Random; -import java.util.Set; -import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.websocket.Session; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; -import org.onap.ransim.websocket.model.*; -import org.onap.ransim.rest.api.models.CellData; +import org.onap.ransim.rest.api.controller.RANSliceConfigController; +import org.onap.ransim.rest.api.handler.RansimPciHandler; +import org.onap.ransim.rest.api.handler.RansimSlicingHandler; import org.onap.ransim.rest.api.models.CellDetails; import org.onap.ransim.rest.api.models.CellNeighbor; -import org.onap.ransim.rest.api.models.FmAlarmInfo; +import org.onap.ransim.rest.api.models.DeleteACellReq; +import org.onap.ransim.rest.api.models.GetACellDetailReq; import org.onap.ransim.rest.api.models.GetNeighborList; -import org.onap.ransim.rest.api.models.NbrDump; +import org.onap.ransim.rest.api.models.GetNeighborListReq; +import org.onap.ransim.rest.api.models.GetNetconfServerDetailsReq; +import org.onap.ransim.rest.api.models.GetPmDataReq; +import org.onap.ransim.rest.api.models.ModifyACellReq; import org.onap.ransim.rest.api.models.NeighborDetails; -import org.onap.ransim.rest.api.models.NeighborPmDetails; import org.onap.ransim.rest.api.models.NeihborId; import org.onap.ransim.rest.api.models.NetconfServers; import org.onap.ransim.rest.api.models.OperationLog; -import org.onap.ransim.rest.api.models.PmDataDump; -import org.onap.ransim.rest.api.models.PmParameters; -import org.onap.ransim.rest.api.models.TopologyDump; -import org.onap.ransim.rest.client.RestClient; -import org.onap.ransim.websocket.model.FmMessage; -import org.onap.ransim.websocket.model.ModifyNeighbor; -import org.onap.ransim.websocket.model.ModifyPci; -import org.onap.ransim.websocket.model.Neighbor; -import org.onap.ransim.websocket.model.PmMessage; -import org.onap.ransim.websocket.model.SetConfigTopology; -import org.onap.ransim.websocket.model.Topology; -import org.onap.ransim.websocket.model.UpdateCell; -import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.onap.ransim.rest.api.models.TACells; +import org.onap.ransim.rest.api.models.Topology; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RansimRepositoryService; +import org.onap.ransim.rest.api.services.SlicingPMDataGenerator; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; - +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Api(value = "Ran Simulator Controller Services") +@RequestMapping("/api") +@CrossOrigin(origins = "*") public class RansimController { - static Logger log = Logger.getLogger(RansimController.class - .getName()); - - private static RansimController rsController = null; - Properties netconfConstants = new Properties(); - int gridSize = 10; - boolean collision = false; - String serverIdPrefix = ""; - static int numberOfCellsPerNcServer = 15; - int numberOfMachines = 1; - int numberOfProcessPerMc = 5; - boolean strictValidateRansimAgentsAvailability = false; - static public Map<String, Session> webSocketSessions = new ConcurrentHashMap<String, Session>(); - static Map<String, String> serverIdIpPortMapping = new ConcurrentHashMap<String, String>(); - - static Map<String, String> globalNcServerUuidMap = new ConcurrentHashMap<String, String>(); - static List<String> unassignedServerIds = Collections - .synchronizedList(new ArrayList<String>()); - static Map<String, List<String>> serverIdIpNodeMapping = new ConcurrentHashMap<String, List<String>>(); - int nextServerIdNumber = 1001; - String sdnrServerIp = ""; - int sdnrServerPort = 0; - static String sdnrServerUserid = ""; - static String sdnrServerPassword = ""; - static String dumpFileName = ""; - static long maxPciValueAllowed = 503; - - static RansimPciHandler rsPciHdlr = RansimPciHandler.getRansimPciHandler(); - - private RansimController() { - - } - - /** - * To accesss variable of this class from another class. - * - * @return returns rscontroller constructor - */ - public static synchronized RansimController getRansimController() { - if (rsController == null) { - rsController = new RansimController(); - new KeepWebsockAliveThread(rsController).start(); - } - return rsController; - } - - private String checkIpPortAlreadyExists(String ipPort, - Map<String, String> serverIdIpPortMapping) { - String serverId = null; - for (String key : serverIdIpPortMapping.keySet()) { - String value = serverIdIpPortMapping.get(key); - if (value.equals(ipPort)) { - serverId = key; - break; - } - } - return serverId; - } - - /** - * Add web socket sessions. - * - * @param ipPort - * ip address for the session - * @param wsSession - * session details - */ - public synchronized String addWebSocketSessions(String ipPort, - Session wsSession) { - loadProperties(); - if (webSocketSessions.containsKey(ipPort)) { - log.info("addWebSocketSessions: Client session " - + wsSession.getId() + " for " + ipPort - + " already exist. Removing old session."); - webSocketSessions.remove(ipPort); - } - - log.info("addWebSocketSessions: Adding Client session " - + wsSession.getId() + " for " + ipPort); - webSocketSessions.put(ipPort, wsSession); - String serverId = null; - if (!serverIdIpPortMapping.containsValue(ipPort)) { - if (unassignedServerIds.size() > 0) { - log.info("addWebSocketSessions: No serverIds pending to assign for " - + ipPort); - serverId = checkIpPortAlreadyExists(ipPort, - serverIdIpPortMapping); - if (serverId == null) { - serverId = unassignedServerIds.remove(0); - } else { - if (unassignedServerIds.contains(serverId)) { - unassignedServerIds.remove(serverId); - } - } - log.info("RansCtrller = Available unassigned ServerIds :" - + unassignedServerIds); - log.info("RansCtrller = addWebSocketSessions: Adding serverId " - + serverId + " for " + ipPort); - serverIdIpPortMapping.put(serverId, ipPort); - log.debug("RansCtrller = serverIdIpPortMapping >>>> :" - + serverIdIpPortMapping); - mapServerIdToNodes(serverId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - - NetconfServers server = rsDb.getNetconfServer(serverId); - if (server != null) { - server.setIp(ipPort.split(":")[0]); - server.setNetconfPort(ipPort.split(":")[1]); - rsDb.mergeNetconfServers(server); - } - - } catch (Exception e1) { - log.info("Exception mapServerIdToNodes :", e1); - } - } else { - log.info("addWebSocketSessions: No serverIds pending to assign for " - + ipPort); - } - } else { - for (String key : serverIdIpPortMapping.keySet()) { - if (serverIdIpPortMapping.get(key).equals(ipPort)) { - log.info("addWebSocketSessions: ServerId " + key + " for " - + ipPort + " is exist already"); - serverId = key; - break; - } - } - } - return serverId; - } - - /** - * Map server ID to the cells - * - * @param serverId - * Server ID - */ - private void mapServerIdToNodes(String serverId) { - dumpSessionDetails(); - if (serverIdIpNodeMapping.containsKey(serverId)) { - // already mapped.RansimController Do nothing. - } else { - List<String> nodeIds = new ArrayList<String>(); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - List<CellDetails> nodes = rsDb.getCellsWithNoServerIds(); - for (CellDetails cell : nodes) { - cell.setServerId(serverId); - nodeIds.add(cell.getNodeId()); - rsDb.mergeCellDetails(cell); - } - serverIdIpNodeMapping.put(serverId, nodeIds); - } catch (Exception e1) { - log.info("Exception mapServerIdToNodes :", e1); - - } - } - } - - /** - * It removes the web socket sessions. - * - * @param ipPort - * ip address of the netconf server - */ - public synchronized void removeWebSocketSessions(String ipPort) { - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - log.info("remove websocket session request received for: " + ipPort); - try { - if (webSocketSessions.containsKey(ipPort)) { - String removedServerId = null; - for (String serverId : serverIdIpPortMapping.keySet()) { - String ipPortVal = serverIdIpPortMapping.get(serverId); - if (ipPortVal.equals(ipPort)) { - if (!unassignedServerIds.contains(serverId)) { - unassignedServerIds.add(serverId); - log.info(serverId + "added in unassignedServerIds"); - } - NetconfServers ns = rsDb.getNetconfServer(serverId); - ns.setIp(null); - ns.setNetconfPort(null); - log.info(serverId + " ip and Port set as null "); - rsDb.mergeNetconfServers(ns); - removedServerId = serverId; - break; - } - } - serverIdIpPortMapping.remove(removedServerId); - - Session wsSession = webSocketSessions.remove(ipPort); - log.info("removeWebSocketSessions: Client session " - + wsSession.getId() + " for " + ipPort - + " is removed. Server Id : " + removedServerId); - } else { - log.info("addWebSocketSessions: Client session for " + ipPort - + " not exist"); - } - } catch (Exception e) { - log.info("Exception in removeWebSocketSessions. e: " + e); - } - - } - - /** - * Checks the number of ransim agents running. - * - * @param cellsToBeSimulated - * number of cells to be simulated - * @return returns true if there are enough ransim agents running - */ - public boolean hasEnoughRansimAgentsRunning(int cellsToBeSimulated) { - - log.info("hasEnoughRansimAgentsRunning: numberOfCellsPerNCServer " - + numberOfCellsPerNcServer + " , webSocketSessions.size:" - + webSocketSessions.size() + " , cellsToBeSimulated:" - + cellsToBeSimulated); - log.info(strictValidateRansimAgentsAvailability); - - if (strictValidateRansimAgentsAvailability) { - if (numberOfCellsPerNcServer * webSocketSessions.size() < cellsToBeSimulated) { - return false; - } - } - return true; - } - - /** - * It updates the constant values in the properties file. - */ - public void loadProperties() { - InputStream input = null; - try { - input = new FileInputStream( - "/tmp/ransim-install/config/ransim.properties"); - netconfConstants.load(input); - serverIdPrefix = netconfConstants.getProperty("serverIdPrefix"); - numberOfCellsPerNcServer = Integer.parseInt(netconfConstants - .getProperty("numberOfCellsPerNCServer")); - numberOfMachines = Integer.parseInt(netconfConstants - .getProperty("numberOfMachines")); - numberOfProcessPerMc = Integer.parseInt(netconfConstants - .getProperty("numberOfProcessPerMc")); - strictValidateRansimAgentsAvailability = Boolean - .parseBoolean(netconfConstants - .getProperty("strictValidateRansimAgentsAvailability")); - sdnrServerIp = netconfConstants.getProperty("sdnrServerIp"); - sdnrServerPort = Integer.parseInt(netconfConstants - .getProperty("sdnrServerPort")); - sdnrServerUserid = netconfConstants.getProperty("sdnrServerUserid"); - sdnrServerPassword = netconfConstants - .getProperty("sdnrServerPassword"); - dumpFileName = netconfConstants.getProperty("dumpFileName"); - maxPciValueAllowed = Long.parseLong(netconfConstants - .getProperty("maxPciValueAllowed")); - - } catch (Exception e) { - log.info("Properties file error", e); - } finally { - try { - if (input != null) { - input.close(); - } - } catch (Exception ex) { - log.info("Properties file error", ex); - } - } - } - - /** - * The function adds the cell(with nodeId passed as an argument) to its - * netconf server list if the netconf server already exists. Else it will - * create a new netconf server in the NetconfServers Table and the cell into - * its list. - * - * @param nodeId - * node Id of the cell - */ - static void setNetconfServers(String nodeId) { - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - CellDetails currentCell = rsDb.getCellDetail(nodeId); - - Set<CellDetails> newList = new HashSet<CellDetails>(); - try { - if (currentCell != null) { - NetconfServers server = rsDb.getNetconfServer(currentCell - .getServerId()); - - if (server == null) { - - server = new NetconfServers(); - server.setServerId(currentCell.getServerId()); - } else { - newList.addAll(server.getCells()); - } - - newList.add(currentCell); - server.setCells(newList); - log.info("setNetconfServers: nodeId: " + nodeId + ", X:" - + currentCell.getGridX() + ", Y:" - + currentCell.getGridY() + ", ip: " + server.getIp() - + ", portNum: " + server.getNetconfPort() - + ", serverId:" + currentCell.getServerId()); - - rsDb.mergeNetconfServers(server); - - } - - } catch (Exception eu) { - log.info("/setNetconfServers Function Error", eu); - - } - } - - private static double degToRadians(double angle) { - double radians = 57.2957795; - return (angle / radians); - } - - private static double metersDeglon(double angle) { - - double d2r = degToRadians(angle); - return ((111415.13 * Math.cos(d2r)) - (94.55 * Math.cos(3.0 * d2r)) + (0.12 * Math - .cos(5.0 * d2r))); - - } - - private static double metersDeglat(double angle) { - - double d2r = degToRadians(angle); - return (111132.09 - (566.05 * Math.cos(2.0 * d2r)) - + (1.20 * Math.cos(4.0 * d2r)) - (0.002 * Math.cos(6.0 * d2r))); - - } - - /** - * generateClusterFromFile() - * - * @throws IOException - */ - static void generateClusterFromFile() throws IOException { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - log.info("Inside generateClusterFromFile"); - File dumpFile = null; - String cellDetailsString = ""; - - dumpFile = new File(dumpFileName); - - BufferedReader br = null; - try { - log.info("Reading dump file"); - br = new BufferedReader(new FileReader(dumpFile)); - - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - while (line != null) { - sb.append(line); - sb.append("\n"); - line = br.readLine(); - } - cellDetailsString = sb.toString(); - - TopologyDump dumpTopo = new Gson().fromJson(cellDetailsString, - TopologyDump.class); - CellDetails cellsDb = new CellDetails(); - - log.info("dumpTopo.getCellList().size():" - + dumpTopo.getCellList().size()); - for (int i = 0; i < dumpTopo.getCellList().size(); i++) { - Gson g = new Gson(); - String pnt = g.toJson(dumpTopo.getCellList().get(i)); - log.info("Creating Cell:" + pnt); - log.info("Creating Cell:" - + dumpTopo.getCellList().get(i).getCell().getNodeId()); - - cellsDb = new CellDetails(); - entitymanager.getTransaction().begin(); - cellsDb.setNodeId(dumpTopo.getCellList().get(i).getCell() - .getNodeId()); - cellsDb.setPhysicalCellId(dumpTopo.getCellList().get(i) - .getCell().getPhysicalCellId()); - cellsDb.setLongitude(dumpTopo.getCellList().get(i).getCell() - .getLongitude()); - cellsDb.setLatitude(dumpTopo.getCellList().get(i).getCell() - .getLatitude()); - cellsDb.setServerId(dumpTopo.getCellList().get(i).getCell() - .getPnfName()); - if (!unassignedServerIds.contains(cellsDb.getServerId())) { - unassignedServerIds.add(cellsDb.getServerId()); - } - cellsDb.setNetworkId(dumpTopo.getCellList().get(i).getCell() - .getNetworkId()); - - double lon = Float.valueOf(dumpTopo.getCellList().get(i) - .getCell().getLongitude()); - double lat = Float.valueOf(dumpTopo.getCellList().get(i) - .getCell().getLatitude()); - - double xx = (lon - 0) * metersDeglon(0); - double yy = (lat - 0) * metersDeglat(0); - - double rad = Math.sqrt(xx * xx + yy * yy); - - if (rad > 0) { - double ct = xx / rad; - double st = yy / rad; - xx = rad * ((ct * Math.cos(0)) + (st * Math.sin(0))); - yy = rad * ((st * Math.cos(0)) - (ct * Math.sin(0))); - } - - cellsDb.setScreenX((float) (xx)); - cellsDb.setScreenY((float) (yy)); - - List<String> attachedNoeds = serverIdIpNodeMapping.get(cellsDb - .getServerId()); - log.info("Attaching Cell:" - + dumpTopo.getCellList().get(i).getCell().getNodeId() - + " to " + cellsDb.getServerId()); - if (attachedNoeds == null) { - attachedNoeds = new ArrayList<String>(); - } - attachedNoeds.add(cellsDb.getNodeId()); - serverIdIpNodeMapping.put(cellsDb.getServerId(), attachedNoeds); - if (attachedNoeds.size() > numberOfCellsPerNcServer) { - log.warn("Attaching Cell:" - + dumpTopo.getCellList().get(i).getCell() - .getNodeId() + " to " - + cellsDb.getServerId() - + ", But it is exceeding numberOfCellsPerNcServer " - + numberOfCellsPerNcServer); - } - - entitymanager.merge(cellsDb); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - setNetconfServers(cellsDb.getNodeId()); - } - - dumpSessionDetails(); - - try { - - for (int i = 0; i < dumpTopo.getCellList().size(); i++) { - - String cellNodeId = dumpTopo.getCellList().get(i).getCell() - .getNodeId(); - entitymanager.getTransaction().begin(); - - // neighbor list with the corresponding node id - CellNeighbor neighborList = entitymanager.find( - CellNeighbor.class, cellNodeId); - // cell with the corresponding nodeId - CellDetails currentCell = entitymanager.find( - CellDetails.class, cellNodeId); - - Set<NeighborDetails> newCell = new HashSet<NeighborDetails>(); - - if (currentCell != null) { - if (neighborList == null) { - neighborList = new CellNeighbor(); - neighborList.setNodeId(cellNodeId); - } - List<NbrDump> neighboursFromFile = dumpTopo - .getCellList().get(i).getNeighbor(); - log.info("Creating Neighbor for Cell :" + cellNodeId); - for (NbrDump a : neighboursFromFile) { - String id = a.getNodeId().trim(); - boolean noHo = Boolean.parseBoolean(a - .getBlacklisted().trim()); - CellDetails neighborCell = entitymanager.find( - CellDetails.class, id); - NeighborDetails neighborDetails = new NeighborDetails( - new NeihborId(currentCell.getNodeId(), - neighborCell.getNodeId()), noHo); - - newCell.add(neighborDetails); - } - - neighborList.setNeighborList(newCell); - entitymanager.merge(neighborList); - entitymanager.flush(); - - entitymanager.getTransaction().commit(); - - rsPciHdlr.setCollisionConfusionFromFile(cellNodeId); - - } - - } - - } catch (Exception e1) { - log.info("Exception generateClusterFromFile :", e1); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - - try { - - long startTimeSectorNumber = System.currentTimeMillis(); - for (int i = 0; i < dumpTopo.getCellList().size(); i++) { - - CellData icellData = dumpTopo.getCellList().get(i); - CellDetails icell = entitymanager.find(CellDetails.class, - icellData.getCell().getNodeId()); - int icount = icell.getSectorNumber(); - if (icount == 0) { - entitymanager.getTransaction().begin(); - log.info("Setting sectorNumber for Cell(i) :" - + icell.getNodeId()); - int jcount = 0; - for (int j = (i + 1); j < dumpTopo.getCellList().size(); j++) { - - CellData jcellData = dumpTopo.getCellList().get(j); - if (icellData.getCell().getLatitude() - .equals(jcellData.getCell().getLatitude())) { - if (icellData - .getCell() - .getLongitude() - .equals(jcellData.getCell() - .getLongitude())) { - - if (icount == 0) { - icount++; - jcount = icount + 1; - } - - CellDetails jcell = entitymanager.find( - CellDetails.class, dumpTopo - .getCellList().get(j) - .getCell().getNodeId()); - - jcell.setSectorNumber(jcount); - log.info("Setting sectorNumber for Cell(j) :" - + jcell.getNodeId() - + " icell: " - + icell.getNodeId() - + " Sector number: " + jcount); - entitymanager.merge(jcell); - jcount++; - if (jcount > 3) { - break; - } - } - } - } - icell.setSectorNumber(icount); - entitymanager.merge(icell); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } - - } - - long endTimeSectorNumber = System.currentTimeMillis(); - log.info("Time taken for setting sector number: " - + (endTimeSectorNumber - startTimeSectorNumber)); - - } catch (Exception e3) { - log.info("Exception generateClusterFromFile :", e3); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - - } catch (Exception e) { - log.info("Exception generateClusterFromFile :", e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } finally { - br.close(); - entitymanager.close(); - emfactory.close(); - } - } - - /** - * The function deletes the cell from the database with the nodeId passed in - * the arguments. It removes the cell from its neighbor's neighbor list and - * the netconf server list. - * - * @param nodeId - * node Id of the cell to be deleted. - * @return returns success or failure message - */ - public static String deleteCellFunction(String nodeId) { - String result = "failure node dosent exist"; - log.info("deleteCellFunction called with nodeId :" + nodeId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - try { - CellDetails deleteCelldetail = rsDb.getCellDetail(nodeId); - - CellNeighbor deleteCellNeighbor = rsDb.getCellNeighbor(nodeId); - - if (deleteCelldetail != null) { - if (deleteCellNeighbor != null) { - List<CellNeighbor> cellNeighborList = rsDb - .getCellNeighborList(); - for (CellNeighbor cellNeighbors : cellNeighborList) { - Set<NeighborDetails> currentCellNeighbors = new HashSet<NeighborDetails>( - cellNeighbors.getNeighborList()); - - NeihborId deleteNeighborDetail = new NeihborId( - cellNeighbors.getNodeId(), - deleteCelldetail.getNodeId()); - - if (currentCellNeighbors.contains(deleteNeighborDetail)) { - log.info("Deleted Cell is Neighbor of NodeId : " - + cellNeighbors.getNodeId()); - currentCellNeighbors.remove(deleteNeighborDetail); - cellNeighbors.setNeighborList(currentCellNeighbors); - rsDb.mergeCellNeighbor(cellNeighbors); - } - } - - deleteCellNeighbor.getNeighborList().clear(); - rsDb.deleteCellNeighbor(deleteCellNeighbor); - } - - rsDb.deleteCellDetails(deleteCelldetail); - result = "cell has been deleted from the database"; - } else { - log.info("cell id does not exist"); - result = "failure nodeId dosent exist"; - return result; - } - } catch (Exception eu) { - log.info("Exception deleteCellFunction :", eu); - - result = "exception in function"; - } - return result; - } - - /** - * Send configuration details to all the netconf server. - */ - public void sendInitialConfigAll() { - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - dumpSessionDetails(); - List<NetconfServers> ncServers = rsDb.getNetconfServersList(); - for (NetconfServers netconfServers : ncServers) { - String ipPortKey = serverIdIpPortMapping.get(netconfServers - .getServerId()); - if (ipPortKey == null || ipPortKey.trim().equals("")) { - log.info("No client for " + netconfServers.getServerId()); - for (String ipPortKeyStr : webSocketSessions.keySet()) { - if (!serverIdIpPortMapping.containsValue(ipPortKeyStr)) { - serverIdIpPortMapping.put( - netconfServers.getServerId(), ipPortKeyStr); - ipPortKey = ipPortKeyStr; - break; - } - } - } - if (ipPortKey != null && !ipPortKey.trim().equals("")) { - Session clSess = webSocketSessions.get(ipPortKey); - if (clSess != null) { - sendInitialConfig(netconfServers.getServerId()); - try { - String[] agentDetails = ipPortKey.split(":"); - new RestClient().sendMountRequestToSdnr( - netconfServers.getServerId(), sdnrServerIp, - sdnrServerPort, agentDetails[0], - agentDetails[1], sdnrServerUserid, - sdnrServerPassword); - } catch (Exception ex1) { - log.info("Ignoring exception", ex1); - } - - } else { - log.info("No session for " + ipPortKey); - } - } - } - } catch (Exception eu) { - log.info("Exception:", eu); - } - } - - /** - * Sends initial configuration details of the cells for a new netconf server - * that has been started. - * - * @param ipPortKey - * ip address details of the netconf server - */ - public void sendInitialConfigForNewAgent(String ipPortKey, String serverId) { - try { - dumpSessionDetails(); - if (ipPortKey != null && !ipPortKey.trim().equals("")) { - if (serverId != null && !serverId.trim().equals("")) { - Session clSess = webSocketSessions.get(ipPortKey); - if (clSess != null) { - String[] agentDetails = ipPortKey.split(":"); - sendInitialConfig(serverId); - new RestClient().sendMountRequestToSdnr(serverId, - sdnrServerIp, sdnrServerPort, agentDetails[0], - agentDetails[1], sdnrServerUserid, - sdnrServerPassword); - } else { - log.info("No session for " + ipPortKey); - } - } else { - log.info("No serverid for " + ipPortKey); - } - } else { - log.info("Invalid ipPortKey " + ipPortKey); - } - } catch (Exception eu) { - log.info("Exception:", eu); - } - } - - /** - * To send the initial configration to the netconf server. - * - * @param serverId - * ip address details of the netconf server - */ - public void sendInitialConfig(String serverId) { - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - NetconfServers server = rsDb.getNetconfServer(serverId); - log.info("sendInitialConfig: serverId:" + serverId + ", server:" - + server); - if (server == null) { - return; - } - - String ipPortKey = serverIdIpPortMapping.get(serverId); - - log.info("sendInitialConfig: ipPortKey:" + ipPortKey); - - List<CellDetails> cellList = new ArrayList<CellDetails>( - server.getCells()); - - List<Topology> config = new ArrayList<Topology>(); - - for (int i = 0; i < server.getCells().size(); i++) { - Topology cell = new Topology(); - CellDetails currentCell = rsDb.getCellDetail(cellList.get(i) - .getNodeId()); - CellNeighbor neighbor = rsDb.getCellNeighbor(cellList.get(i) - .getNodeId()); - - cell.setCellId("" + currentCell.getNodeId()); - cell.setPciId(currentCell.getPhysicalCellId()); - cell.setPnfName(serverId); - - List<Neighbor> nbrList = new ArrayList<Neighbor>(); - Set<NeighborDetails> nbrsDet = neighbor.getNeighborList(); - for (NeighborDetails cellDetails : nbrsDet) { - Neighbor nbr = new Neighbor(); - CellDetails nbrCell = rsDb.getCellDetail(cellDetails - .getNeigbor().getNeighborCell()); - nbr.setNodeId(nbrCell.getNodeId()); - nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); - nbr.setPnfName(nbrCell.getServerId()); - nbr.setServerId(nbrCell.getServerId()); - nbr.setPlmnId(nbrCell.getNetworkId()); - nbr.setBlacklisted(cellDetails.isBlacklisted()); - nbrList.add(nbr); - } - cell.setNeighborList(nbrList); - config.add(i, cell); - } - - SetConfigTopology topo = new SetConfigTopology(); - - topo.setServerId(server.getServerId()); - String uuid = globalNcServerUuidMap.get(server.getServerId()); - if (uuid == null) { - uuid = getUuid(); - globalNcServerUuidMap.put(server.getServerId(), uuid); - } - topo.setUuid(uuid); - - topo.setTopology(config); - - Gson gson = new Gson(); - String jsonStr = gson.toJson(topo); - log.info("ConfigTopologyMessage: " + jsonStr); - Session clSess = webSocketSessions.get(ipPortKey); - RansimWebSocketServer.sendSetConfigTopologyMessage(jsonStr, clSess); - - } catch (Exception eu) { - log.info("Exception:", eu); - } - - } - - private static String getUuid() { - return UUID.randomUUID().toString(); - } - - /** - * The function alters the database information based on the modifications - * made in the SDNR. - * - * @param message - * message received from the SDNR - * @param session - * sends the session details - * @param ipPort - * ip address of the netconf server - */ - public void handleModifyPciFromSdnr(String message, Session session, - String ipPort) { - log.info("handleModifyPciFromSDNR: message:" + message + " session:" - + session + " ipPort:" + ipPort); - RansimControllerDatabase rcDb = new RansimControllerDatabase(); - ModifyPci modifyPci = new Gson().fromJson(message, ModifyPci.class); - log.info("handleModifyPciFromSDNR: modifyPci:" + modifyPci.getCellId() - + "; pci: " + modifyPci.getPciId()); - String source = "Netconf"; - - CellDetails cd = rcDb.getCellDetail(modifyPci.getCellId()); - long pci = cd.getPhysicalCellId(); - cd.setPhysicalCellId(modifyPci.getPciId()); - rcDb.mergeCellDetails(cd); - rsPciHdlr.updatePciOperationsTable(modifyPci.getCellId(), source, pci, - modifyPci.getPciId()); - } - - /** - * The function alters the database information based on the modifications - * made in the SDNR. - * - * @param message - * message received from the SDNR - * @param session - * sends the session details - * @param ipPort - * ip address of the netconf server - */ - public void handleModifyNeighborFromSdnr(String message, Session session, - String ipPort) { - log.info("handleModifyAnrFromSDNR: message:" + message + " session:" - + session + " ipPort:" + ipPort); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - ModifyNeighbor modifyNeighbor = new Gson().fromJson(message, - ModifyNeighbor.class); - log.info("handleModifyAnrFromSDNR: modifyPci:" - + modifyNeighbor.getCellId()); - CellDetails currentCell = rsDb - .getCellDetail(modifyNeighbor.getCellId()); - List<NeighborDetails> neighborList = new ArrayList<NeighborDetails>(); - List<String> cellList = new ArrayList<String>(); - cellList.add(modifyNeighbor.getCellId()); - String nbrsAdd = ""; - String nbrsDel = ""; - String source = "Netconf"; - - for (int i = 0; i < modifyNeighbor.getNeighborList().size(); i++) { - if (modifyNeighbor.getNeighborList().get(i).isBlacklisted()) { - NeighborDetails nd = new NeighborDetails(new NeihborId( - modifyNeighbor.getCellId(), modifyNeighbor - .getNeighborList().get(i).getNodeId()), true); - rsDb.mergeNeighborDetails(nd); - cellList.add(modifyNeighbor.getNeighborList().get(i) - .getNodeId()); - if (nbrsAdd.equals("")) { - nbrsDel = modifyNeighbor.getNeighborList().get(i) - .getNodeId(); - } else { - nbrsDel += "," - + modifyNeighbor.getNeighborList().get(i) - .getNodeId(); - } - } else { - NeighborDetails nd = new NeighborDetails(new NeihborId( - modifyNeighbor.getCellId(), modifyNeighbor - .getNeighborList().get(i).getNodeId()), false); - rsDb.mergeNeighborDetails(nd); - cellList.add(modifyNeighbor.getNeighborList().get(i) - .getNodeId()); - if (nbrsDel.equals("")) { - nbrsAdd = modifyNeighbor.getNeighborList().get(i) - .getNodeId(); - } else { - nbrsAdd += "," - + modifyNeighbor.getNeighborList().get(i) - .getNodeId(); - } - } - - } - - for (String cl : cellList) { - RansimPciHandler.setCollisionConfusionFromFile(cl); - } - - log.info("neighbor list: " + neighborList); - - rsPciHdlr.updateNbrsOperationsTable(modifyNeighbor.getCellId(), source, - nbrsAdd, nbrsDel); - } - - /** - * The function sends the modification made in the GUI to the netconf - * server. - * - * @param cellId - * node Id of the cell which was modified - * @param pciId - * PCI number of the cell which was modified - */ - public void handleModifyPciFromGui(String cellId, long pciId) { - log.info("handleModifyPciFromGUI: cellId:" + cellId + " pciId:" + pciId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - try { - CellDetails currentCell = rsDb.getCellDetail(cellId); - CellNeighbor neighborList = rsDb.getCellNeighbor(cellId); - List<Neighbor> nbrList = new ArrayList<Neighbor>(); - Iterator<NeighborDetails> iter = neighborList.getNeighborList() - .iterator(); - while (iter.hasNext()) { - NeighborDetails nbCell = iter.next(); - Neighbor nbr = new Neighbor(); - CellDetails nbrCell = rsDb.getCellDetail(nbCell.getNeigbor() - .getNeighborCell()); - - nbr.setNodeId(nbrCell.getNodeId()); - nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); - nbr.setPnfName(nbrCell.getNodeName()); - nbr.setServerId(nbrCell.getServerId()); - nbr.setPlmnId(nbrCell.getNetworkId()); - nbrList.add(nbr); - } - - String pnfName = currentCell.getServerId(); - String ipPort = serverIdIpPortMapping.get(pnfName); - log.info("handleModifyPciFromGui:ipPort >>>>>>> " + ipPort); - - if (ipPort != null && !ipPort.trim().equals("")) { - - String[] ipPortArr = ipPort.split(":"); - Topology oneCell = new Topology(pnfName, pciId, cellId, nbrList); - UpdateCell updatedPci = new UpdateCell( - currentCell.getServerId(), ipPortArr[0], ipPortArr[1], - oneCell); - Gson gson = new Gson(); - String jsonStr = gson.toJson(updatedPci); - if (ipPort != null && !ipPort.trim().equals("")) { - Session clSess = webSocketSessions.get(ipPort); - if (clSess != null) { - RansimWebSocketServer.sendUpdateCellMessage(jsonStr, - clSess); - log.info("handleModifyPciFromGui, message: " + jsonStr); - } else { - log.info("No client session for " + ipPort); - } - } else { - log.info("No client for " + currentCell.getServerId()); - } - } - - } catch (Exception eu) { - - log.info("Exception:", eu); - } - } - - /** - * The function unmounts the connection with SDNR. - * - * @return returns null value - */ - public String stopAllCells() { - RansimControllerDatabase rcDb = new RansimControllerDatabase(); - try { - List<NetconfServers> ncServers = rcDb.getNetconfServersList(); - for (NetconfServers netconfServers : ncServers) { - try { - log.info("Unmount " + netconfServers.getServerId()); - new RestClient().sendUnmountRequestToSdnr( - netconfServers.getServerId(), sdnrServerIp, - sdnrServerPort, sdnrServerUserid, - sdnrServerPassword); - } catch (Exception e) { - log.info("Ignore Exception:", e); - } - serverIdIpNodeMapping.clear(); - } - return "Netconf servers unmounted."; - } catch (Exception eu) { - - log.info("Exception:", eu); - return "Error"; - } - - } - - /** - * Used to dump session details. - */ - synchronized public static void dumpSessionDetails() { - - try { - - log.info("serverIdIpPortMapping.size:" - + serverIdIpPortMapping.size() + "webSocketSessions.size" - + webSocketSessions.size()); - for (String key : serverIdIpPortMapping.keySet()) { - String val = serverIdIpPortMapping.get(key); - Session sess = webSocketSessions.get(val); - log.info("ServerId:" + key + " IpPort:" + val + " Session:" - + sess); - } - for (String serverId : unassignedServerIds) { - log.info("Unassigned ServerId:" + serverId); - } - for (String serverId : serverIdIpPortMapping.keySet()) { - List<String> attachedNoeds = serverIdIpNodeMapping - .get(serverId); - if (attachedNoeds != null) { - log.info("ServerId:" + serverId + " attachedNoeds.size:" - + attachedNoeds.size() + " nodes:" - + attachedNoeds.toArray()); - } else { - log.info("ServerId:" + serverId + " attachedNoeds:" + null); - } - } - } catch (Exception e) { - log.info("Exception:", e); - } - } - -} - -class KeepWebsockAliveThread extends Thread { - static Logger log = Logger - .getLogger(KeepWebsockAliveThread.class.getName()); - RansimController rsCtrlr = null; - - KeepWebsockAliveThread(RansimController ctrlr) { - rsCtrlr = ctrlr; - } - - @Override - public void run() { - log.info("Inside KeepWebsockAliveThread run method"); - while (true) { - for (String ipPort : rsCtrlr.webSocketSessions.keySet()) { - try { - Session sess = rsCtrlr.webSocketSessions.get(ipPort); - RansimWebSocketServer.sendPingMessage(sess); - log.debug("Sent ping message to Client ipPort:" + ipPort); - } catch (Exception ex1) { - } - } - try { - Thread.sleep(10000); - } catch (Exception ex) { - } - } - } + static Logger log = Logger.getLogger(RansimController.class.getName()); + + private static boolean isPmDataGenerating = false; + private static boolean isIntelligentSlicingPmDataGenerating = false; + + ScheduledExecutorService execService = Executors.newScheduledThreadPool(5); + ScheduledExecutorService execServiceForIntelligentSlicing = Executors.newScheduledThreadPool(5); + ScheduledExecutorService closedLoopExecService; + + @Autowired + RansimRepositoryService ransimRepo; + @Autowired + RansimControllerServices rscServices; + @Autowired + RansimPciHandler rsPciHdlr; + @Autowired + RANSliceConfigController ranSliceConfigController; + @Autowired + RANSliceConfigService ranSliceConfigService; + @Autowired + RansimSlicingHandler ranSliceHandler; + @Autowired + SlicingPMDataGenerator pmDataGenerator; + + /** + * Start the RAN network simulation. + * + * @param req gets the necessary details as a request of class type + * StartSimulationReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Starts the RAN network simulation") + @RequestMapping(value = "/StartSimulation", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation")}) + public ResponseEntity<String> startSimulation(@RequestBody Map<String, String> dumpfile) throws Exception { + + List<CellDetails> cellList = ransimRepo.getCellDetailsList(); + if (!cellList.isEmpty()) { + return new ResponseEntity<>("Already simulation is running.", HttpStatus.INTERNAL_SERVER_ERROR); + } + try { + rscServices.loadProperties(); + RansimControllerServices.dumpFileName = dumpfile.containsKey("dumpfile") ? dumpfile.get("dumpfile") : null; + long startTimeStartSimulation = System.currentTimeMillis(); + rscServices.generateClusterFromFile(); + rscServices.sendInitialConfigAll(); + long endTimeStartSimulation = System.currentTimeMillis(); + log.info("Time taken for start simulation : " + (endTimeStartSimulation - startTimeStartSimulation)); + + return new ResponseEntity<String>(HttpStatus.OK); + + } catch (Exception eu) { + log.info("/StartSimulation ", eu); + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + + @ApiOperation("Starts the RAN network slice simulation") + @RequestMapping(value = "/StartRanSliceSimulation", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation")}) + public ResponseEntity<String> startRanSliceSimulation() throws Exception { + try { + rscServices.loadGNBFunctionProperties(); + long startTimeStartSimulation = System.currentTimeMillis(); + rscServices.sendRanInitialConfigAll(); + long endTimeStartSimulation = System.currentTimeMillis(); + log.info("Time taken for start ran slice simulation : " + + (endTimeStartSimulation - startTimeStartSimulation)); + return new ResponseEntity<>("Simulation started.", HttpStatus.OK); + + } catch (Exception eu) { + log.info("/StartRanSliceSimulation ", eu); + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * The performance Management Data of each cell will be sent to its netconf + * agent at a regular interval. + * + * @param req Contains the details of node ids which will have bad and poor pm + * values + * @return return HTTP status. + * + */ + @ApiOperation("Generate PM data") + @RequestMapping(value = "/GeneratePmData", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation")}) + public ResponseEntity<String> generatePmData(@RequestBody GetPmDataReq req) throws Exception { + + log.info("Generate PM Data - nodeId_bad: " + req.getNodeIdBad() + ", nodeId_poor: " + req.getNodeIdPoor()); + try { + rsPciHdlr.readPmParameters(); + execService = Executors.newScheduledThreadPool(5); + execService.scheduleAtFixedRate(() -> { + + rsPciHdlr.generatePmData(req.getNodeIdBad(), req.getNodeIdPoor()); + log.info("execService.isTerminated(): " + execService.isTerminated()); + + }, 0, 300, TimeUnit.SECONDS); + + isPmDataGenerating = true; + + return new ResponseEntity<>("Request generated.", HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception: ", eu); + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + + } + + } + + /** + * Terminates the ScheduledExecutorService which sends the PM data at regular + * interval. + * + * @return returns HTTP status + * + */ + @ApiOperation("stop PM data") + @RequestMapping(value = "/stopPmData", method = RequestMethod.GET) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation")}) + public ResponseEntity<String> stopPmData() throws Exception { + + try { + log.info("1. execService.isTerminated(): " + execService.isTerminated()); + if (!execService.isTerminated()) { + execService.shutdown(); + log.info("2. execService.isTerminated(): " + execService.isTerminated()); + + } + isPmDataGenerating = false; + return new ResponseEntity<>("PM data generated.", HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception: ", eu); + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + + /** + * Get the status of ScheduledExecutorService, whether active or terminated. + * + * @return return the status + * + */ + @ApiOperation("get PM data status") + @RequestMapping(value = "/GetPmDataStatus", method = RequestMethod.GET) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot get information")}) + public boolean getPmDataStatus() throws Exception { + + try { + return isPmDataGenerating; + } catch (Exception eu) { + log.error("Exception: ", eu); + return false; + } + + } + + /** + * The function retrieves RAN simulation network topology. + * + * @return returns Http status + * @throws Exception throws exceptions in the functions + * + */ + @ApiOperation("Retrieves RAN simulation network topology") + @RequestMapping(value = "/GetTopology", method = RequestMethod.GET) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot retrieve the RAN simulation network topology details")}) + public ResponseEntity<String> getTopology() throws Exception { + log.debug("Inside getTopology..."); + try { + rsPciHdlr.checkCollisionAfterModify(); + List<CellDetails> cds = ransimRepo.getCellDetailsList(); + + Topology top = new Topology(); + + if (cds != null && cds.size() > 0) { + top.setMinScreenX(cds.get(0).getScreenX()); + top.setMaxScreenX(cds.get(0).getScreenX()); + top.setMinScreenY(cds.get(0).getScreenY()); + top.setMaxScreenY(cds.get(0).getScreenY()); + + for (int i = 0; i < cds.size(); i++) { + if (cds.get(i).getScreenX() < top.getMinScreenX()) { + top.setMinScreenX(cds.get(i).getScreenX()); + } + if (cds.get(i).getScreenY() < top.getMinScreenY()) { + top.setMinScreenY(cds.get(i).getScreenY()); + } + + if (cds.get(i).getScreenX() > top.getMaxScreenX()) { + top.setMaxScreenX(cds.get(i).getScreenX()); + } + if (cds.get(i).getScreenY() > top.getMaxScreenY()) { + top.setMaxScreenY(cds.get(i).getScreenY()); + } + } + top.setCellTopology(cds); + } + top.setGridSize(rscServices.gridSize); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(top); + + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + + } catch (Exception eu) { + log.error("GetTopology", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * The function retrieves the neighbor list details for the cell with the + * mentioned nodeId. + * + * @param req gets the necessary details as a request of class type + * GetNeighborListReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") + @RequestMapping(value = "/GetNeighborList", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot Insert the given parameters")}) + public ResponseEntity<String> getNeighborList(@RequestBody GetNeighborListReq req) throws Exception { + log.debug("Inside getNeighborList..."); + + try { + String jsonStr = ""; + + GetNeighborList message = rsPciHdlr.generateNeighborList(req.getNodeId()); + + if (message != null) { + + log.info("message.getNodeId(): " + message.getNodeId()); + + Gson gson = new Gson(); + jsonStr = gson.toJson(message); + } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + + } catch (Exception eu) { + log.info("/getNeighborList", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * The function retrieves the neighbor list for the cell with the mentioned + * nodeId. + * + * @param req gets the necessary details as a request of class type + * GetNeighborListReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") + @RequestMapping(value = "/GetNeighborBlacklistDetails", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot Insert the given parameters")}) + public ResponseEntity<String> getNeighborBlacklistDetails(@RequestBody GetNeighborListReq req) throws Exception { + log.debug("Inside getNeighborList..."); + + try { + String jsonStr = ""; + + CellNeighbor neighborList = ransimRepo.getCellNeighbor(req.getNodeId()); + + Map<String, String> result = new ConcurrentHashMap<String, String>(); + + for (NeighborDetails nd : neighborList.getNeighborList()) { + + result.put(nd.getNeigbor().getNeighborCell(), "" + nd.isBlacklisted()); + } + + if (result != null) { + Gson gson = new Gson(); + jsonStr = gson.toJson(result); + } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + + } catch (Exception eu) { + log.error("/getNeighborList", eu); + + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * Changes the pci number or nbr list for the given cell. + * + * @param req gets the necessary details as a request of class type + * ModifyACellReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Changes the pci number or nbr list for the given cell") + @RequestMapping(value = "/ModifyACell", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot update the PCI for the given cell")}) + public ResponseEntity<String> modifyACell(@RequestBody ModifyACellReq req) throws Exception { + log.debug("Inside ModifyCell..."); + + try { + long startTimemodifyCell = System.currentTimeMillis(); + + String nbrsStr = req.getNewNbrs(); + if (req.getNewNbrs() == null) { + nbrsStr = ""; + } + String source = "GUI"; + List<NeighborDetails> nbrsList = new ArrayList<NeighborDetails>(); + String[] newNbrsArr = nbrsStr.split(","); + + for (int i = 0; i < newNbrsArr.length; i++) { + NeighborDetails cell = new NeighborDetails(new NeihborId(req.getNodeId(), newNbrsArr[i].trim()), false); + nbrsList.add(cell); + } + + int result = rsPciHdlr.modifyCellFunction(req.getNodeId(), req.getNewPhysicalCellId(), nbrsList, source); + rscServices.handleModifyPciFromGui(req.getNodeId(), req.getNewPhysicalCellId()); + long endTimemodifyCell = System.currentTimeMillis(); + log.info("Time taken to modify cell : " + (endTimemodifyCell - startTimemodifyCell)); + + if (result == 200) { + return new ResponseEntity<String>(HttpStatus.OK); + } else if (result == 400) { + return new ResponseEntity<String>(HttpStatus.BAD_REQUEST); + } else { + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } catch (Exception eu) { + log.error("Exception in modifyACell", eu); + return new ResponseEntity<>("Cannot update the PCI for the given cell", HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + + /** + * The function changes the PCI number of the cell for the the mentioned nodeId. + * + * @param req gets the necessary details as a request of class type + * GetACellDetailReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Changes the pci number of the cell for the the mentioned nodeId") + @PostMapping(value = "/GetACellDetail") + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot retrive the cell details for the given cell")}) + public ResponseEntity<String> getACellDetail(@RequestBody GetACellDetailReq req) throws Exception { + + log.debug("Inside GetACellDetailReq..."); + try { + String jsonStr = null; + + CellDetails cd = ransimRepo.getCellDetail(req.getNodeId()); + if (cd != null) { + Gson gson = new Gson(); + jsonStr = gson.toJson(cd); + } + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception in getACellDetail : {} ", eu); + return new ResponseEntity<>("Cannot update the PCI for the given cell", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * The function deletes a cell with the mentioned nodeId. + * + * @param req gets the necessary details as a request of class type + * DeleteACellReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Deletes a cell with the mentioned nodeId") + @RequestMapping(value = "/DeleteACell", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot delete the given cell")}) + public ResponseEntity<String> deleteACell(@RequestBody DeleteACellReq req) throws Exception { + log.debug("Inside delete cell..."); + + try { + long startTimeDeleteCell = System.currentTimeMillis(); + String result = rscServices.deleteCellFunction(req.getNodeId()); + long endTimeDeleteCell = System.currentTimeMillis(); + log.info("Time taken to delete cell : " + (endTimeDeleteCell - startTimeDeleteCell)); + return new ResponseEntity<String>(HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception in deleteACell", eu); + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * The function stops RAN network simulation and deletes all the cell data from + * the database. + * + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Stops RAN network simulation and deletes all the cell data from the database") + @RequestMapping(value = "/StopSimulation", method = RequestMethod.DELETE) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot stop simulation")}) + public ResponseEntity<String> stopSimulation() throws Exception { + log.debug("Inside stopSimulation..."); + + if (ransimRepo.getCellDetailsList().isEmpty()) { + return new ResponseEntity<>("No simulation is running.", HttpStatus.INTERNAL_SERVER_ERROR); + } + + try { + long startTimStopSimulation = System.currentTimeMillis(); + ransimRepo.deleteNetconfServers(); + ransimRepo.deleteCellNeighbors(); + log.info("Stop simulation : " + (startTimStopSimulation)); + ransimRepo.deleteAllCellDetails(); + String result = rscServices.stopAllSimulation(); + log.info("All cell simulation are stopped...." + result); + long endTimStopSimulation = System.currentTimeMillis(); + log.info("Time taken for stopping simulation : " + (endTimStopSimulation - startTimStopSimulation)); + return new ResponseEntity<>("Success", HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception in stopSimulation", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + + @ApiOperation("Stops RAN Slicing network simulation and deletes all the data from the database") + @RequestMapping(value = "/StopRanSliceSimulation", method = RequestMethod.DELETE) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot stop simulation")}) + public ResponseEntity<String> stopRanSliceSimulation() throws Exception { + log.debug("Inside stopSimulation..."); + if (ransimRepo.getCellDetailsList().isEmpty()) { + return new ResponseEntity<>("No simulation is running.", HttpStatus.INTERNAL_SERVER_ERROR); + } + + try { + long startTimStopSimulation = System.currentTimeMillis(); + ransimRepo.deleteNetconfServers(); + log.info("Stop simulation : " + (startTimStopSimulation)); + String result = rscServices.stopAllSimulation(); + log.info("All cell simulation are stopped...." + result); + long endTimStopSimulation = System.currentTimeMillis(); + log.info("Time taken for stopping simulation : " + (endTimStopSimulation - startTimStopSimulation)); + return new ResponseEntity<>("Simulation stopped", HttpStatus.OK); + + } catch (Exception eu) { + log.error("Exception in stopRanSliceSimulation", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + + /** + * The function returns the details of a Netconf server for the mentioned server + * id. + * + * @param req gets the necessary details as a request of class type + * GetNetconfServerDetailsReq + * @return returns Http status + * @throws Exception throws exceptions in the functions + */ + @ApiOperation("Returns the details of a Netconf server for the mentioned server id") + @RequestMapping(value = "/GetNetconfServerDetails", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API")}) + public ResponseEntity<String> getNetconfServerDetails(@RequestBody GetNetconfServerDetailsReq req) + throws Exception { + + try { + log.debug("Inside GetNetconfServerDetails API..."); + String result = ""; + String input = req.getServerId(); + if (input.startsWith("Chn")) { + CellDetails cds = ransimRepo.getCellDetail(input); + if (cds != null) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(cds); + result = "{\"serverId\":\"any\",\"cells\":[" + jsonStr + "]}"; + } else { + result = ("Cell Id does not exist"); + } + } else { + NetconfServers ns = ransimRepo.getNetconfServer(input); + if (ns != null) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(ns); + result = jsonStr; + } else { + result = ("Server Id does not exist"); + } + } + return new ResponseEntity<>(result, HttpStatus.OK); + + } catch (Exception eu) { + log.error("/GetNetconfServers", eu); + return new ResponseEntity<>("Failure in GetNetconfServerDetails API", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @ApiOperation("Returns the connection status of all netconf servers") + @RequestMapping(value = "/GetNetconfStatus", method = RequestMethod.GET) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API")}) + public ResponseEntity<String> GetNetconfStatus() throws Exception { + + try { + log.debug("Inside GetNetconfServerDetails API..."); + String result = ""; + + List<NetconfServers> ns = ransimRepo.getNetconfServersList(); + if (ns != null) { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.serializeNulls(); + Gson gson = gsonBuilder.create(); + String jsonStr = gson.toJson(ns); + result = jsonStr; + } else { + result = ("Server Id does not exist"); + } + + return new ResponseEntity<>(result, HttpStatus.OK); + + } catch (Exception eu) { + log.error("/GetNetconfServers", eu); + return new ResponseEntity<>("Failure in GetNetconfServerDetails API", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + /** + * The function retrieves RAN simulation network topology. + * + * @return returns Http status + * @throws Exception throws exceptions in the functions + * + */ + @ApiOperation("Retrieves operations log - Modify/Delete operations performed") + @GetMapping(value = "/GetOperationLog") + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot retrieve the Operation Logs")}) + public ResponseEntity<String> getOperationLog() throws Exception { + log.debug("Inside getOperationLog..."); + try { + List<OperationLog> ols = ransimRepo.getOperationLogList(); + if (ols != null && ols.size() > 0) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(ols); + return new ResponseEntity<>(jsonStr, HttpStatus.OK); + } else { + return new ResponseEntity<>("", HttpStatus.OK); + } + } catch (Exception eu) { + log.error("/GetOperationLog", eu); + return new ResponseEntity<>("Failure", HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @ApiOperation("Generate IntelligentSlicing PM data") + @RequestMapping(value = "/GenerateIntelligentSlicingPmData", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot t the simulation")}) + public ResponseEntity<String> generateIntelligentSlicingPmData() { + log.info("******************Request to generate***************************"); + + try { + long startTime = (System.currentTimeMillis()); + Iterable<TACells> tacellList = ranSliceConfigService.fetchAllTA(); + HashMap<String, List<String>> taCells = new HashMap<>(); + for (TACells ta : tacellList) { + String[] cells = ta.getCellsList().split(","); + List<String> cellList = new ArrayList<String>(Arrays.asList(cells)); + taCells.put(ta.getTrackingArea(), cellList); + } + execServiceForIntelligentSlicing = Executors.newScheduledThreadPool(5); + execServiceForIntelligentSlicing.scheduleAtFixedRate(() -> { + + ranSliceHandler.generateIntelligentSlicingPmData(startTime, taCells); + log.info("execServiceforIntelligentSlicing.isTerminated(): " + + execServiceForIntelligentSlicing.isTerminated()); + + }, 0, 10, TimeUnit.SECONDS); + + isIntelligentSlicingPmDataGenerating = true; + + } catch (Exception eu) { + log.info("Exception: ", eu); + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + + } + return new ResponseEntity<>("IntelligentSlicing PM data generated.", HttpStatus.OK); + } + + @ApiOperation("Stop IntelligentSlicing PM data") + @RequestMapping(value = "/stopIntelligentSlicingPmData", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation")}) + public ResponseEntity<String> stopIntelligentSlicingPmData() throws Exception { + + try { + log.info("1. execServiceForIntelligentSlicing.isTerminated(): " + + execServiceForIntelligentSlicing.isTerminated()); + if (!execServiceForIntelligentSlicing.isTerminated()) { + execServiceForIntelligentSlicing.shutdown(); + log.info("2. execServiceForIntelligentSlicing.isTerminated(): " + + execServiceForIntelligentSlicing.isTerminated()); + + } + isIntelligentSlicingPmDataGenerating = false; + return new ResponseEntity<>("Stopped PM data generation.", HttpStatus.OK); + + } catch (Exception eu) { + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + + /* + * Generate closed loopPM data for DUs + * + */ + @ApiOperation("Generate Closed loop PM data") + @RequestMapping(value = "/generateClosedLoopPmData", method = RequestMethod.POST) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Problem generating closed loop PM data")}) + public ResponseEntity<String> generateClosedLoopPmData() { + long startTime = (System.currentTimeMillis()); + log.info("Closed loop PM Data generation started at " + startTime); + closedLoopExecService = Executors.newScheduledThreadPool(5); + closedLoopExecService.scheduleAtFixedRate(() -> { + pmDataGenerator.generateClosedLoopPmData(startTime); + log.info("closedLoopexecService.isTerminated(): " + execServiceForIntelligentSlicing.isTerminated()); + + }, 0, 10, TimeUnit.SECONDS); + + return new ResponseEntity<>("Generating Closed loop PM data.", HttpStatus.OK); + } + + @ApiOperation("Stop Closed loop PM data") + @RequestMapping(value = "/stopClosedLoopPmData", method = RequestMethod.GET) + @ApiResponses( + value = {@ApiResponse(code = 200, message = "Successful"), + @ApiResponse(code = 500, message = "Cannot start the simulation")}) + public ResponseEntity<String> stopClosedLoopPmData() throws Exception { + + try { + log.info("1. closedLoopexecService.isTerminated(): " + closedLoopExecService.isTerminated()); + if (!closedLoopExecService.isTerminated()) { + closedLoopExecService.shutdown(); + log.info("2. closedLoopexecService.isTerminated(): " + closedLoopExecService.isTerminated()); + + } + return new ResponseEntity<>("Closed loop PM data generated.", HttpStatus.OK); + + } catch (Exception eu) { + return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerDatabase.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerDatabase.java deleted file mode 100644 index 0d7ea3a..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerDatabase.java +++ /dev/null @@ -1,409 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2020 Wipro Limited. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.ransim.rest.api.controller; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.persistence.Query; -import javax.persistence.TypedQuery; - -import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.models.CellDetails; -import org.onap.ransim.rest.api.models.CellNeighbor; -import org.onap.ransim.rest.api.models.NeighborDetails; -import org.onap.ransim.rest.api.models.NetconfServers; -import org.onap.ransim.rest.api.models.OperationLog; - -public class RansimControllerDatabase { - - static Logger log = Logger.getLogger(RansimControllerDatabase.class - .getName()); - - /** - * Gets the CellDetail from the database. - * - * @param nodeId Node Id of the cell(primary key) - * @return Returns the cell with mentioned node ID. - */ - CellDetails getCellDetail(String nodeId){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - CellDetails currentCell = null; - - try{ - currentCell = entitymanager.find(CellDetails.class, nodeId); - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - - return currentCell; - - } - - /** - * - * @param serverId - * @return - */ - static NetconfServers getNetconfServer(String serverId){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - NetconfServers ns = null; - - try{ - ns = entitymanager.find(NetconfServers.class, serverId); - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - - return ns; - - } - CellNeighbor getCellNeighbor(String nodeId){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - CellNeighbor ns = null; - - try{ - ns = entitymanager.find(CellNeighbor.class, nodeId); - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - - return ns; - - } - - void deleteCellDetails(CellDetails deleteCelldetail){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - - - - try{ - if (deleteCelldetail.getServerId() != null) { - entitymanager.getTransaction().begin(); - log.info("inside NetconfServers handling ...."); - NetconfServers ns = entitymanager.find(NetconfServers.class, deleteCelldetail.getServerId()); - ns.getCells().remove(deleteCelldetail); - entitymanager.merge(ns); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - } - entitymanager.getTransaction().begin(); - CellDetails cd = entitymanager.find(CellDetails.class, deleteCelldetail.getNodeId()); - entitymanager.remove(cd); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - }catch(Exception e){ - log.info("Exception in getCellDetail: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - } - - void deleteCellNeighbor(CellNeighbor deleteCellNeighbor){ - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - - entitymanager.getTransaction().begin(); - - try{ - log.info("inside delete cel neighbor"); - CellNeighbor cn = entitymanager.find(CellNeighbor.class, deleteCellNeighbor.getNodeId()); - entitymanager.remove(cn); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - log.info("removed cell neighbor from database"); - - }catch(Exception e){ - log.info("Exception in deleteCellNeighbor: " + e); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - } - finally { - entitymanager.close(); - emfactory.close(); - } - } - - static void mergeCellDetails(CellDetails cellDetail){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - entitymanager.merge(cellDetail); - log.info("updated in database...."); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - }catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - void mergeNeighborDetails(NeighborDetails neighborDetails){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - entitymanager.merge(neighborDetails); - log.info("updated in database...."); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - void mergeNetconfServers(NetconfServers netconfServers){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - entitymanager.merge(netconfServers); - log.info("updated in database...."); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - void mergeCellNeighbor(CellNeighbor cellNeighbor){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try{ - entitymanager.getTransaction().begin(); - log.info("updated in database...."); - entitymanager.merge(cellNeighbor); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - List<CellDetails> getCellDetailsList(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List<CellDetails> cds = new ArrayList<CellDetails>(); - try{ - entitymanager.getTransaction().begin(); - log.info("updated in database...."); - Query query = entitymanager.createQuery("from CellDetails cd", CellDetails.class); - cds = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cds; - } - - List<CellDetails> getCellsWithNoServerIds(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List<CellDetails> cds = new ArrayList<CellDetails>(); - try{ - entitymanager.getTransaction().begin(); - log.info("getCellswithNoServerIds: updated in database...."); - TypedQuery<CellDetails> query = entitymanager.createQuery( - "SELECT n FROM CellDetails WHERE n.serverId is null", CellDetails.class); - cds = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cds; - } - - List<CellDetails> getCellsWithCollisionOrConfusion(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List<CellDetails> cds = new ArrayList<CellDetails>(); - try{ - entitymanager.getTransaction().begin(); - log.info("getCellsWithCollisionOrConfusion: updated in database...."); - Query query = entitymanager - .createQuery( - "from CellDetails cd where cd.pciCollisionDetected=true or cd.pciConfusionDetected=true", - CellDetails.class); - cds = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cds; - } - - List<OperationLog> getOperationLogList(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List<OperationLog> ols = new ArrayList<OperationLog>(); - try{ - entitymanager.getTransaction().begin(); - log.info("updated in database...."); - Query query = entitymanager.createQuery("from OperationLog ol", OperationLog.class); - ols = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return ols; - } - - List<NetconfServers> getNetconfServersList(){ - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List<NetconfServers> cnl = new ArrayList<NetconfServers>(); - try{ - log.info("updated in database...."); - Query query = entitymanager.createQuery("from NetconfServers ns", NetconfServers.class); - cnl = query.getResultList(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - return cnl; - } - - List<CellNeighbor> getCellNeighborList() { - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - List<CellNeighbor> cellNeighborList = new ArrayList<CellNeighbor>(); - try { - entitymanager.getTransaction().begin(); - TypedQuery<CellNeighbor> query = entitymanager.createQuery("from CellNeighbor cn", CellNeighbor.class); - cellNeighborList = query.getResultList(); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - return cellNeighborList; - } - -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerServices.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerServices.java deleted file mode 100644 index 9fc130c..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimControllerServices.java +++ /dev/null @@ -1,730 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2020 Wipro Limited. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.ransim.rest.api.controller; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.persistence.Query; - -import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.models.CellDetails; -import org.onap.ransim.rest.api.models.CellNeighbor; -import org.onap.ransim.rest.api.models.DeleteACellReq; -import org.onap.ransim.rest.api.models.GetACellDetailReq; -import org.onap.ransim.rest.api.models.GetNeighborList; -import org.onap.ransim.rest.api.models.GetNeighborListReq; -import org.onap.ransim.rest.api.models.GetNetconfServerDetailsReq; -import org.onap.ransim.rest.api.models.GetPmDataReq; -import org.onap.ransim.rest.api.models.ModifyACellReq; -import org.onap.ransim.rest.api.models.NeighborDetails; -import org.onap.ransim.rest.api.models.NeihborId; -import org.onap.ransim.rest.api.models.NetconfServers; -import org.onap.ransim.rest.api.models.OperationLog; -import org.onap.ransim.rest.api.models.Topology; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -@RestController -@Api(value = "Ran Simulator Controller Services") -@RequestMapping("/") -@CrossOrigin(origins = "*") -public class RansimControllerServices { - - static Logger log = Logger.getLogger(RansimControllerServices.class - .getName()); - - private static boolean isSimulationStarted = false; - private static boolean isPmDataGenerating = false; - - private static RansimControllerServices rscServices = null; - - ScheduledExecutorService execService = Executors.newScheduledThreadPool(5); - - private RansimControllerServices() { - - } - - /** - * To accesss variable of this class from another class. - * - * @return returns rscServices constructor - */ - public static synchronized RansimControllerServices getRansimControllerServices() { - if (rscServices == null) { - rscServices = new RansimControllerServices(); - } - return rscServices; - } - - RansimController rsCtrlr = RansimController.getRansimController(); - RansimPciHandler rsPciHdlr = RansimPciHandler.getRansimPciHandler(); - - /** - * Start the RAN network simulation. - * - * @param req - * gets the necessary details as a request of class type - * StartSimulationReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Starts the RAN network simulation") - @RequestMapping(value = "/StartSimulation", method = RequestMethod.POST) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot start the simulation") }) - public ResponseEntity<String> startSimulation() throws Exception { - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - List<CellDetails> cellList = rsDb.getCellDetailsList(); - if (!cellList.isEmpty()) { - return new ResponseEntity<>("Already simulation is running.", - HttpStatus.INTERNAL_SERVER_ERROR); - } - - try { - rsCtrlr.loadProperties(); - long startTimeStartSimulation = System.currentTimeMillis(); - rsCtrlr.generateClusterFromFile(); - rsCtrlr.sendInitialConfigAll(); - long endTimeStartSimulation = System.currentTimeMillis(); - log.info("Time taken for start simulation : " - + (endTimeStartSimulation - startTimeStartSimulation)); - - return new ResponseEntity<String>(HttpStatus.OK); - - } catch (Exception eu) { - log.info("/StartSimulation ", eu); - return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - - /** - * The performance Management Data of each cell will be sent to its netconf - * agent at a regular interval. - * - * @param req - * Contains the details of node ids which will have bad and poor - * pm values - * @return return HTTP status. - * - */ - @ApiOperation("Generate PM data") - @RequestMapping(value = "/GeneratePmData", method = RequestMethod.POST) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot start the simulation") }) - public ResponseEntity<String> generatePmData(@RequestBody GetPmDataReq req) - throws Exception { - - log.info("Inside generatePmData..."); - log.info("nodeId_bad: " + req.getNodeIdBad()); - log.info("nodeId_poor: " + req.getNodeIdPoor()); - - try { - rsPciHdlr.readPmParameters(); - execService = Executors.newScheduledThreadPool(5); - execService.scheduleAtFixedRate( - () -> { - - List<String> resp = rsPciHdlr.generatePmData( - req.getNodeIdBad(), req.getNodeIdPoor()); - log.info("execService.isTerminated(): " - + execService.isTerminated()); - - }, 0, 300, TimeUnit.SECONDS); - - isPmDataGenerating = true; - - return new ResponseEntity<>("Request generated.", HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception: ", eu); - return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); - - } - - } - - /** - * Terminates the ScheduledExecutorService which sends the PM data at - * regular interval. - * - * @return returns HTTP status - * - */ - @ApiOperation("stop PM data") - @RequestMapping(value = "/stopPmData", method = RequestMethod.GET) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot start the simulation") }) - public ResponseEntity<String> stopPmData() throws Exception { - - long startTime = (System.currentTimeMillis() / 1000); - - try { - log.info("1. execService.isTerminated(): " - + execService.isTerminated()); - if (!execService.isTerminated()) { - execService.shutdown(); - log.info("2. execService.isTerminated(): " - + execService.isTerminated()); - - } - isPmDataGenerating = false; - return new ResponseEntity<>("PM data generated.", HttpStatus.OK); - - } catch (Exception eu) { - return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - - /** - * Get the status of ScheduledExecutorService, whether active or terminated. - * - * @return return the status - * - */ - @ApiOperation("get PM data status") - @RequestMapping(value = "/GetPmDataStatus", method = RequestMethod.GET) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot get information") }) - public boolean getPmDataStatus() throws Exception { - - try { - return isPmDataGenerating; - } catch (Exception eu) { - return false; - } - - } - - /** - * The function retrieves RAN simulation network topology. - * - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - * - */ - @ApiOperation("Retrieves RAN simulation network topology") - @RequestMapping(value = "/GetTopology", method = RequestMethod.GET) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot retrieve the RAN simulation network topology details") }) - public ResponseEntity<String> getTopology() throws Exception { - log.info("Inside getTopology..."); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - rsPciHdlr.checkCollisionAfterModify(); - List<CellDetails> cds = rsDb.getCellDetailsList(); - - Topology top = new Topology(); - - if (cds != null && cds.size() > 0) { - top.setMinScreenX(cds.get(0).getScreenX()); - top.setMaxScreenX(cds.get(0).getScreenX()); - top.setMinScreenY(cds.get(0).getScreenY()); - top.setMaxScreenY(cds.get(0).getScreenY()); - - for (int i = 0; i < cds.size(); i++) { - if (cds.get(i).getScreenX() < top.getMinScreenX()) { - top.setMinScreenX(cds.get(i).getScreenX()); - } - if (cds.get(i).getScreenY() < top.getMinScreenY()) { - top.setMinScreenY(cds.get(i).getScreenY()); - } - - if (cds.get(i).getScreenX() > top.getMaxScreenX()) { - top.setMaxScreenX(cds.get(i).getScreenX()); - } - if (cds.get(i).getScreenY() > top.getMaxScreenY()) { - top.setMaxScreenY(cds.get(i).getScreenY()); - } - } - top.setCellTopology(cds); - } - top.setGridSize(rsCtrlr.gridSize); - - Gson gson = new Gson(); - String jsonStr = gson.toJson(top); - - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/GetTopology", eu); - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function retrieves the neighbor list details for the cell with the - * mentioned nodeId. - * - * @param req - * gets the necessary details as a request of class type - * GetNeighborListReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") - @RequestMapping(value = "/GetNeighborList", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot Insert the given parameters") }) - public ResponseEntity<String> getNeighborList( - @RequestBody GetNeighborListReq req) throws Exception { - log.info("Inside getNeighborList..."); - - try { - String jsonStr = ""; - - GetNeighborList message = rsPciHdlr.generateNeighborList(req - .getNodeId()); - - if (message != null) { - - log.info("message.getNodeId(): " + message.getNodeId()); - - Gson gson = new Gson(); - jsonStr = gson.toJson(message); - } - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/getNeighborList", eu); - - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function retrieves the neighbor list for the cell with the mentioned - * nodeId. - * - * @param req - * gets the necessary details as a request of class type - * GetNeighborListReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Retrieves the neighbor list details for the cell with the mentioned nodeId") - @RequestMapping(value = "/GetNeighborBlacklistDetails", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot Insert the given parameters") }) - public ResponseEntity<String> getNeighborBlacklistDetails( - @RequestBody GetNeighborListReq req) throws Exception { - log.info("Inside getNeighborList..."); - - try { - String jsonStr = ""; - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - CellNeighbor neighborList = rsDb.getCellNeighbor(req.getNodeId()); - - Map<String, String> result = new ConcurrentHashMap<String, String>(); - - for (NeighborDetails nd : neighborList.getNeighborList()) { - - result.put(nd.getNeigbor().getNeighborCell(), - "" + nd.isBlacklisted()); - } - - if (result != null) { - Gson gson = new Gson(); - jsonStr = gson.toJson(result); - } - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/getNeighborList", eu); - - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * Changes the pci number or nbr list for the given cell. - * - * @param req - * gets the necessary details as a request of class type - * ModifyACellReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Changes the pci number or nbr list for the given cell") - @RequestMapping(value = "/ModifyACell", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot update the PCI for the given cell") }) - public ResponseEntity<String> modifyACell(@RequestBody ModifyACellReq req) - throws Exception { - log.info("Inside ModifyCell..."); - - try { - long startTimemodifyCell = System.currentTimeMillis(); - - String nbrsStr = req.getNewNbrs(); - if (req.getNewNbrs() == null) { - nbrsStr = ""; - } - String source = "GUI"; - List<NeighborDetails> nbrsList = new ArrayList<NeighborDetails>(); - String[] newNbrsArr = nbrsStr.split(","); - - for (int i = 0; i < newNbrsArr.length; i++) { - NeighborDetails cell = new NeighborDetails(new NeihborId( - req.getNodeId(), newNbrsArr[i].trim()), false); - nbrsList.add(cell); - } - - int result = rsPciHdlr.modifyCellFunction(req.getNodeId(), - req.getNewPhysicalCellId(), nbrsList, source); - log.info("Inside modify cell : " + (startTimemodifyCell)); - log.info("Result:********************" + result); - rsCtrlr.handleModifyPciFromGui(req.getNodeId(), - req.getNewPhysicalCellId()); - long endTimemodifyCell = System.currentTimeMillis(); - log.info("Time taken to modify cell : " - + (endTimemodifyCell - startTimemodifyCell)); - - if (result == 200) { - return new ResponseEntity<String>(HttpStatus.OK); - } else if (result == 400) { - return new ResponseEntity<String>(HttpStatus.BAD_REQUEST); - } else { - return new ResponseEntity<String>( - HttpStatus.INTERNAL_SERVER_ERROR); - } - - } catch (Exception eu) { - log.info("Exception in modifyACell", eu); - - return new ResponseEntity<>( - "Cannot update the PCI for the given cell", - HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - - /** - * The function changes the PCI number of the cell for the the mentioned - * nodeId. - * - * @param req - * gets the necessary details as a request of class type - * GetACellDetailReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Changes the pci number of the cell for the the mentioned nodeId") - @RequestMapping(value = "/GetACellDetail", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot retrive the cell details for the given cell") }) - public ResponseEntity<String> getACellDetail( - @RequestBody GetACellDetailReq req) throws Exception { - log.info("Inside GetACellDetailReq..."); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - String jsonStr = null; - - CellDetails cd = rsDb.getCellDetail(req.getNodeId()); - - if (cd != null) { - Gson gson = new Gson(); - jsonStr = gson.toJson(cd); - } - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception in modifyACell", eu); - return new ResponseEntity<>( - "Cannot update the PCI for the given cell", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function deletes a cell with the mentioned nodeId. - * - * @param req - * gets the necessary details as a request of class type - * DeleteACellReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Deletes a cell with the mentioned nodeId") - @RequestMapping(value = "/DeleteACell", method = RequestMethod.POST) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot delete the given cell") }) - public ResponseEntity<String> deleteACell(@RequestBody DeleteACellReq req) - throws Exception { - log.info("Inside delete cell..."); - - try { - long startTimeDeleteCell = System.currentTimeMillis(); - String result = rsCtrlr.deleteCellFunction(req.getNodeId()); - log.info("deleted in database...." + result); - long endTimeDeleteCell = System.currentTimeMillis(); - log.info("Time taken to delete cell : " - + (endTimeDeleteCell - startTimeDeleteCell)); - - return new ResponseEntity<String>(HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception in deleteACell", eu); - return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function stops RAN network simulation and deletes all the cell data - * from the database. - * - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Stops RAN network simulation and deletes all the cell data from the database") - @RequestMapping(value = "/StopSimulation", method = RequestMethod.DELETE) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot stop simulation") }) - public ResponseEntity<String> stopSimulation() throws Exception { - log.info("Inside stopSimulation..."); - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - - Query query = entitymanager.createQuery("from CellDetails cd", - CellDetails.class); - if (query.getResultList() == null) { - return new ResponseEntity<>("No simulation is running.", - HttpStatus.INTERNAL_SERVER_ERROR); - } - - try { - entitymanager.getTransaction().begin(); - long startTimStopSimulation = System.currentTimeMillis(); - Query q3 = entitymanager - .createQuery("DELETE FROM NetconfServers ns"); - q3.executeUpdate(); - - Query q2 = entitymanager.createQuery("DELETE FROM CellNeighbor cn"); - q2.executeUpdate(); - - Query q4 = entitymanager - .createQuery("DELETE FROM NeighborDetails cn"); - q4.executeUpdate(); - - log.info("Stop simulation : " + (startTimStopSimulation)); - Query q1 = entitymanager.createQuery("DELETE FROM CellDetails cd"); - q1.executeUpdate(); - - String result = rsCtrlr.stopAllCells(); - log.info("All cell simulation are stopped...." + result); - - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - long endTimStopSimulation = System.currentTimeMillis(); - log.info("Time taken for stopping simulation : " - + (endTimStopSimulation - startTimStopSimulation)); - - isSimulationStarted = false; - return new ResponseEntity<>("Success", HttpStatus.OK); - - } catch (Exception eu) { - log.info("Exception in stopSimulation", eu); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } finally { - entitymanager.close(); - emfactory.close(); - } - - } - - /** - * The function returns the details of a Netconf server for the mentioned - * server id. - * - * @param req - * gets the necessary details as a request of class type - * GetNetconfServerDetailsReq - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - */ - @ApiOperation("Returns the details of a Netconf server for the mentioned server id") - @RequestMapping(value = "/GetNetconfServerDetails", method = RequestMethod.POST) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API") }) - public ResponseEntity<String> getNetconfServerDetails( - @RequestBody GetNetconfServerDetailsReq req) throws Exception { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try { - log.info("Inside GetNetconfServerDetails API..."); - String result = ""; - entitymanager.getTransaction().begin(); - String input = req.getServerId(); - if (input.startsWith("Chn")) { - CellDetails cds = entitymanager.find(CellDetails.class, input); - if (cds != null) { - Gson gson = new Gson(); - String jsonStr = gson.toJson(cds); - result = "{\"serverId\":\"any\",\"cells\":[" + jsonStr - + "]}"; - } else { - result = ("Cell Id does not exist"); - } - } else { - NetconfServers ns = entitymanager.find(NetconfServers.class, - req.getServerId()); - if (ns != null) { - Gson gson = new Gson(); - String jsonStr = gson.toJson(ns); - result = jsonStr; - } else { - result = ("Server Id does not exist"); - } - } - return new ResponseEntity<>(result, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/GetNetconfServers", eu); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - return new ResponseEntity<>( - "Failure in GetNetconfServerDetails API", - HttpStatus.INTERNAL_SERVER_ERROR); - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - @ApiOperation("Returns the connection status of all netconf servers") - @RequestMapping(value = "/GetNetconfStatus", method = RequestMethod.GET) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Failure in GetNetconfServerDetails API") }) - public ResponseEntity<String> GetNetconfStatus() throws Exception { - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - log.info("Inside GetNetconfServerDetails API..."); - String result = ""; - - List<NetconfServers> ns = rsDb.getNetconfServersList(); - if (ns != null) { - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); - Gson gson = gsonBuilder.create(); - String jsonStr = gson.toJson(ns); - result = jsonStr; - } else { - result = ("Server Id does not exist"); - } - - return new ResponseEntity<>(result, HttpStatus.OK); - - } catch (Exception eu) { - log.info("/GetNetconfServers", eu); - return new ResponseEntity<>( - "Failure in GetNetconfServerDetails API", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - /** - * The function retrieves RAN simulation network topology. - * - * @return returns Http status - * @throws Exception - * throws exceptions in the functions - * - */ - @ApiOperation("Retrieves operations log - Modify/Delete operations performed") - @RequestMapping(value = "/GetOperationLog", method = RequestMethod.GET) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Successful"), - @ApiResponse(code = 500, message = "Cannot retrieve the Operation Logs") }) - public ResponseEntity<String> getOperationLog() throws Exception { - log.info("Inside getOperationLog..."); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - List<OperationLog> ols = rsDb.getOperationLogList(); - if (ols != null && ols.size() > 0) { - Gson gson = new Gson(); - String jsonStr = gson.toJson(ols); - return new ResponseEntity<>(jsonStr, HttpStatus.OK); - } else { - return new ResponseEntity<>("", HttpStatus.OK); - } - } catch (Exception eu) { - log.info("/GetOperationLog", eu); - return new ResponseEntity<>("Failure", - HttpStatus.INTERNAL_SERVER_ERROR); - } - } - -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimPciHandler.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimPciHandler.java deleted file mode 100644 index e4796e8..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/controller/RansimPciHandler.java +++ /dev/null @@ -1,1011 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2020 Wipro Limited. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.ransim.rest.api.controller; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import javax.websocket.Session; - -import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.models.CellDetails; -import org.onap.ransim.rest.api.models.CellNeighbor; -import org.onap.ransim.rest.api.models.FmAlarmInfo; -import org.onap.ransim.rest.api.models.GetNeighborList; -import org.onap.ransim.rest.api.models.NeighborDetails; -import org.onap.ransim.rest.api.models.NetconfServers; -import org.onap.ransim.rest.api.models.OperationLog; -import org.onap.ransim.rest.api.models.PmDataDump; -import org.onap.ransim.rest.api.models.PmParameters; -import org.onap.ransim.websocket.model.AdditionalMeasurements; -import org.onap.ransim.websocket.model.CommonEventHeaderFm; -import org.onap.ransim.websocket.model.CommonEventHeaderPm; -import org.onap.ransim.websocket.model.EventFm; -import org.onap.ransim.websocket.model.EventPm; -import org.onap.ransim.websocket.model.FaultFields; -import org.onap.ransim.websocket.model.FmMessage; -import org.onap.ransim.websocket.model.Measurement; -import org.onap.ransim.websocket.model.PmMessage; -import org.onap.ransim.websocket.server.RansimWebSocketServer; - -import com.google.gson.Gson; - -public class RansimPciHandler { - - private static RansimPciHandler rsPciHandler = null; - - private RansimPciHandler() { - - } - - /** - * To accesss variable of this class from another class. - * - * @return returns rscontroller constructor - */ - public static synchronized RansimPciHandler getRansimPciHandler() { - if (rsPciHandler == null) { - rsPciHandler = new RansimPciHandler(); - } - return rsPciHandler; - } - - static Logger log = Logger.getLogger(RansimPciHandler.class - .getName()); - - RansimController rsCtrlr = RansimController.getRansimController(); - - static Map<String, String> globalFmCellIdUuidMap = new ConcurrentHashMap<String, String>(); - static Map<String, String> globalPmCellIdUuidMap = new ConcurrentHashMap<String, String>(); - - Set<String> cellsWithIssues = new HashSet<>(); - - List<PmParameters> pmParameters = new ArrayList<PmParameters>(); - int next = 0; - - static FmAlarmInfo setCollisionConfusionFromFile(String cellNodeId) { - - FmAlarmInfo result = new FmAlarmInfo(); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - try { - - boolean collisionDetected = false; - boolean confusionDetected = false; - List<Long> nbrPcis = new ArrayList<Long>(); - List<Long> ConfusionPcis = new ArrayList<Long>(); - int collisionCount = 0; - int confusionCount = 0; - CellDetails currentCell = rsDb.getCellDetail(cellNodeId); - - log.info("Setting confusion/collision for Cell :" + cellNodeId); - - GetNeighborList cellNbrDetails = generateNeighborList(cellNodeId); - - for (CellDetails firstLevelNbr : cellNbrDetails.getCellsWithHo()) { - if (nbrPcis - .contains(new Long(firstLevelNbr.getPhysicalCellId()))) { - confusionDetected = true; - if (ConfusionPcis.contains(firstLevelNbr - .getPhysicalCellId())) { - confusionCount++; - } else { - ConfusionPcis.add(firstLevelNbr.getPhysicalCellId()); - confusionCount = confusionCount + 2; - } - - } else { - nbrPcis.add(new Long(firstLevelNbr.getPhysicalCellId())); - } - - if (currentCell.getPhysicalCellId() == firstLevelNbr - .getPhysicalCellId()) { - collisionDetected = true; - collisionCount++; - } - } - - currentCell.setPciCollisionDetected(collisionDetected); - currentCell.setPciConfusionDetected(confusionDetected); - - if (!currentCell.isPciCollisionDetected() - && !currentCell.isPciConfusionDetected()) { - currentCell.setColor("#BFBFBF"); // GREY - No Issues - result.setProblem("No Issues"); - } else if (currentCell.isPciCollisionDetected() - && currentCell.isPciConfusionDetected()) { - currentCell.setColor("#C30000"); // BROWN - Cell has both - // collision & confusion - result.setProblem("CollisionAndConfusion"); - - } else if (currentCell.isPciCollisionDetected()) { - currentCell.setColor("#FF0000"); // RED - Cell has collision - result.setProblem("Collision"); - - } else if (currentCell.isPciConfusionDetected()) { - currentCell.setColor("#E88B00"); // ORANGE - Cell has confusion - result.setProblem("Confusion"); - - } else { - currentCell.setColor("#BFBFBF"); // GREY - No Issues - result.setProblem("No Issues"); - } - - result.setCollisionCount("" + collisionCount); - result.setConfusionCount("" + confusionCount); - - rsDb.mergeCellDetails(currentCell); - - return result; - - } catch (Exception e2) { - log.info("setCollisionConfusionFromFile :", e2); - - return null; - } - - } - - /** - * Generates separate list of neighbors with and without hand-off for a - * cell. - * - * @param nodeId - * Node Id of cell for which the neighbor list is generated - * @return Returns GetNeighborList object - */ - static GetNeighborList generateNeighborList(String nodeId) { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try { - log.info("inside generateNeighborList for: " + nodeId); - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - CellNeighbor neighborList = entitymanager.find(CellNeighbor.class, - nodeId); - GetNeighborList result = new GetNeighborList(); - - List<CellDetails> cellsWithNoHO = new ArrayList<CellDetails>(); - List<CellDetails> cellsWithHO = new ArrayList<CellDetails>(); - - List<NeighborDetails> nbrList = new ArrayList<NeighborDetails>( - neighborList.getNeighborList()); - long readCellDetail = 0; - long checkBlacklisted = 0; - - for (int i = 0; i < nbrList.size(); i++) { - - CellDetails nbr = entitymanager.find(CellDetails.class, nbrList - .get(i).getNeigbor().getNeighborCell()); - - if (nbrList.get(i).isBlacklisted()) { - cellsWithNoHO.add(nbr); - } else { - cellsWithHO.add(nbr); - } - - } - - result.setNodeId(nodeId); - result.setCellsWithHo(cellsWithHO); - result.setCellsWithNoHo(cellsWithNoHO); - - return result; - - } catch (Exception eu) { - log.info("/getNeighborList", eu); - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - return null; - } finally { - entitymanager.close(); - emfactory.close(); - } - } - - static void checkCollisionAfterModify() { - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - try { - List<CellDetails> checkCollisionConfusion = rsDb - .getCellsWithCollisionOrConfusion(); - - for (int i = 0; i < checkCollisionConfusion.size(); i++) { - log.info(checkCollisionConfusion.get(i).getNodeId()); - setCollisionConfusionFromFile(checkCollisionConfusion.get(i) - .getNodeId()); - } - } catch (Exception eu) { - log.info("checkCollisionAfterModify", eu); - } - } - - /** - * It updates the cell with its new neighbor list and PCI and updates the - * change in a database. - * - * @param nodeId - * node Id of the cell - * @param physicalCellId - * PCI number of the cell - * @param newNbrs - * List of new neighbors for the cell - * @param source - * The source from which cell modification has been triggered - * @return returns success or failure message - */ - public int modifyCellFunction(String nodeId, long physicalCellId, - List<NeighborDetails> newNbrs, String source) { - - int result = 111; - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - log.info("modifyCellFunction nodeId:" + nodeId + ", physicalCellId:" - + physicalCellId); - CellDetails modifyCell = rsDb.getCellDetail(nodeId); - - if (modifyCell != null) { - if (physicalCellId < 0 - || physicalCellId > rsCtrlr.maxPciValueAllowed) { - log.info("NewPhysicalCellId is empty or invalid"); - result = 400; - } else { - long oldPciId = modifyCell.getPhysicalCellId(); - if (physicalCellId != oldPciId) { - updatePciOperationsTable(nodeId, source, physicalCellId, - oldPciId); - - modifyCell.setPhysicalCellId(physicalCellId); - rsDb.mergeCellDetails(modifyCell); - } - - CellNeighbor neighbors = rsDb.getCellNeighbor(nodeId); - List<NeighborDetails> oldNbrList = new ArrayList<NeighborDetails>( - neighbors.getNeighborList()); - List<NeighborDetails> oldNbrListWithHo = new ArrayList<NeighborDetails>(); - - for (NeighborDetails cell : oldNbrList) { - if (!cell.isBlacklisted()) { - oldNbrListWithHo.add(cell); - } - } - - boolean flag = false; - - List<NeighborDetails> addedNbrs = new ArrayList<NeighborDetails>(); - List<NeighborDetails> deletedNbrs = new ArrayList<NeighborDetails>(); - - String nbrsDel = ""; - - List<String> oldNbrsArr = new ArrayList<String>(); - for (NeighborDetails cell : oldNbrListWithHo) { - oldNbrsArr.add(cell.getNeigbor().getNeighborCell()); - } - - List<String> newNbrsArr = new ArrayList<String>(); - for (NeighborDetails cell : newNbrs) { - newNbrsArr.add(cell.getNeigbor().getNeighborCell()); - } - - for (NeighborDetails cell : oldNbrListWithHo) { - - if (!newNbrsArr.contains(cell.getNeigbor() - .getNeighborCell())) { - if (!flag) { - flag = true; - } - deletedNbrs.add(cell); - if (nbrsDel == "") { - nbrsDel = cell.getNeigbor().getNeighborCell(); - } else { - nbrsDel += "," - + cell.getNeigbor().getNeighborCell(); - } - log.info("deleted cell: " - + cell.getNeigbor().getNeighborCell() - + cell.isBlacklisted()); - - } - } - - String nbrsAdd = ""; - - for (NeighborDetails cell : newNbrs) { - if (cell.isBlacklisted()) { - addedNbrs.add(cell); - } else { - if (!oldNbrsArr.contains(cell.getNeigbor() - .getNeighborCell())) { - addedNbrs.add(cell); - if (nbrsAdd == "") { - nbrsAdd = cell.getNeigbor().getNeighborCell(); - } else { - nbrsAdd += "," - + cell.getNeigbor().getNeighborCell(); - } - log.info("added cell: " - + cell.getNeigbor().getNeighborCell() - + cell.isBlacklisted()); - } - } - - } - List<NeighborDetails> newNeighborList = new ArrayList<NeighborDetails>( - oldNbrList); - for (NeighborDetails cell : deletedNbrs) { - NeighborDetails removeHo = new NeighborDetails( - cell.getNeigbor(), true); - rsDb.mergeNeighborDetails(removeHo); - newNeighborList.add(removeHo); - } - - for (NeighborDetails cell : addedNbrs) { - rsDb.mergeNeighborDetails(cell); - newNeighborList.add(cell); - } - - if (!flag) { - if (newNbrs.size() != oldNbrList.size()) { - flag = true; - } - } - - if (flag) { - updateNbrsOperationsTable(nodeId, source, nbrsAdd, nbrsDel); - } - - if (newNbrs != null) { - neighbors.getNeighborList().clear(); - Set<NeighborDetails> updatedNbrList = new HashSet<NeighborDetails>( - newNeighborList); - neighbors.setNeighborList(updatedNbrList); - rsDb.mergeCellNeighbor(neighbors); - } - - generateFmData(source, modifyCell, newNeighborList); - - result = 200; - } - - - } else { - result = 400; - } - - return result; - } - - public void checkCellsWithIssue() { - - EntityManagerFactory emfactory = Persistence - .createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - try { - - for (String id : cellsWithIssues) { - CellDetails currentCell = entitymanager.find(CellDetails.class, - id); - FmMessage fmDataMessage = new FmMessage(); - List<EventFm> data = new ArrayList<EventFm>(); - - if (!currentCell.isPciCollisionDetected()) { - if (!currentCell.isPciConfusionDetected()) { - - cellsWithIssues.remove(id); - CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); - FaultFields faultFields = new FaultFields(); - - commonEventHeader.setStartEpochMicrosec(System - .currentTimeMillis() * 1000); - commonEventHeader - .setSourceName(currentCell.getNodeId()); - commonEventHeader.setReportingEntityName(currentCell - .getServerId()); - String uuid = globalFmCellIdUuidMap.get(currentCell - .getNodeId()); - commonEventHeader.setSourceUuid(uuid); - - faultFields - .setAlarmCondition("RanPciCollisionConfusionOccurred"); - faultFields.setEventSeverity("NORMAL"); - faultFields.setEventSourceType("other"); - faultFields.setSpecificProblem("Problem Solved"); - - commonEventHeader.setLastEpochMicrosec(System - .currentTimeMillis() * 1000); - - EventFm event = new EventFm(); - event.setCommonEventHeader(commonEventHeader); - event.setFaultFields(faultFields); - - data.add(event); - } - } - - fmDataMessage.setFmEventList(data); - - if (!data.isEmpty()) { - sendFmData(currentCell.getServerId(), fmDataMessage); - } - - } - - } catch (Exception eu) { - if (entitymanager.getTransaction().isActive()) { - entitymanager.getTransaction().rollback(); - } - log.info("Exception:", eu); - } finally { - entitymanager.close(); - emfactory.close(); - } - - } - - void updatePciOperationsTable(String nodeId, String source, long physicalCellId, long oldPciId) { - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - OperationLog operationLog = new OperationLog(); - - entitymanager.getTransaction().begin(); - operationLog.setNodeId(nodeId); - operationLog.setFieldName("PCID"); - operationLog.setOperation("Modify"); - operationLog.setSource(source); - operationLog.setTime(System.currentTimeMillis()); - operationLog.setMessage("PCID value changed from " + oldPciId + " to " + physicalCellId); - entitymanager.merge(operationLog); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - } - - void updateNbrsOperationsTable(String nodeId, String source, String addedNbrs, String deletedNbrs) { - - EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("ransimctrlrdb"); - EntityManager entitymanager = emfactory.createEntityManager(); - entitymanager.getTransaction().begin(); - OperationLog operationLogNbrChng = new OperationLog(); - operationLogNbrChng.setNodeId(nodeId); - operationLogNbrChng.setFieldName("Neighbors"); - operationLogNbrChng.setOperation("Modify"); - operationLogNbrChng.setSource(source); - - log.info(" Neighbors added " + addedNbrs + "."); - log.info(" Neighbors removed " + deletedNbrs + "."); - String message = ""; - if(!addedNbrs.equals("")){ - message += " Neighbors added " + addedNbrs + "." ; - } - - if(!deletedNbrs.equals("")){ - message += " Neighbors removed " + deletedNbrs + "." ; - } - - operationLogNbrChng.setMessage(message); - operationLogNbrChng.setTime(System.currentTimeMillis()); - entitymanager.merge(operationLogNbrChng); - entitymanager.flush(); - entitymanager.getTransaction().commit(); - - } - - /** - * Sends PM message to the netconf agent through the websocket server. - * - * @param serverId - * Netconf agent - Server ID to which the message is sent. - * @param pmMessage - * PM message to be sent. - */ - void sendPmdata(String serverId, String pmMessage) { - - log.info("Sending PM message to netconf agent"); - - String ipPort = rsCtrlr.serverIdIpPortMapping.get(serverId); - - if (ipPort != null && !ipPort.trim().equals("")) { - - String[] ipPortArr = ipPort.split(":"); - if (ipPort != null && !ipPort.trim().equals("")) { - - Session clSess = rsCtrlr.webSocketSessions.get(ipPort); - log.info("PM message. Netconf agent IP:" + ipPort); - if (clSess != null) { - RansimWebSocketServer.sendPmMessage(pmMessage, clSess); - log.info("Pm Data jsonStr: " + pmMessage); - log.info("PM message sent to netconf agent"); - } else { - log.info("No client session for " + ipPort); - } - } else { - log.info("Pm message not sent, ipPort is null"); - } - } else { - - log.info("Pm message not sent, ipPort is null. Server Id: " - + serverId); - } - - } - - /** - * - * Reads the values PM parameter values from a dump file. - * - */ - public void readPmParameters() { - - File dumpFile = null; - String kpiName = ""; - PmDataDump pmDump = null; - String jsonString = ""; - int next = 0; - dumpFile = new File("PM_Kpi_Data.json"); - - BufferedReader br = null; - - try { - log.info("Reading dump file"); - br = new BufferedReader(new FileReader(dumpFile)); - - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - - while (line != null) { - sb.append(line); - sb.append("\n"); - line = br.readLine(); - } - jsonString = sb.toString(); - - pmDump = new Gson().fromJson(jsonString, PmDataDump.class); - log.info("Dump value: " - + pmDump.getKpiDump().get(0).getParameter1()); - pmParameters = new ArrayList<PmParameters>(pmDump.getKpiDump()); - - } catch (Exception eu) { - log.info("Exception: ", eu); - } - } - - private static String getUuid() { - return UUID.randomUUID().toString(); - } - - /** - * Sets values for all the parameters in the PM message - * - * @param nodeIdBad - * List of node Ids with bad performance values - * @param nodeIdPoor - * List of node Ids with poor performance values - * @return It returns the pm message - */ - public List<String> generatePmData(String nodeIdBad, String nodeIdPoor) { - - List<String> result = new ArrayList<>(); - RansimControllerDatabase rcDb = new RansimControllerDatabase(); - - String parameter1 = ""; - String successValue1 = ""; - String badValue1 = ""; - String poorValue1 = ""; - String parameter2 = ""; - String successValue2 = ""; - String badValue2 = ""; - String poorValue2 = ""; - - try { - - if (next >= pmParameters.size()) { - next = 0; - log.info("next : " + next); - } - try { - log.info("next : " + next); - parameter1 = pmParameters.get(next).getParameter1(); - successValue1 = pmParameters.get(next).getSuccessValue1(); - badValue1 = pmParameters.get(next).getBadValue1(); - poorValue1 = pmParameters.get(next).getPoorValue1(); - parameter2 = pmParameters.get(next).getParameter2(); - successValue2 = pmParameters.get(next).getSuccessValue2(); - badValue2 = pmParameters.get(next).getBadValue2(); - poorValue2 = pmParameters.get(next).getPoorValue2(); - next++; - } catch (Exception e) { - log.info("Exception: ", e); - } - - List<NetconfServers> cnl = rcDb.getNetconfServersList(); - log.info("obtained data from db"); - String[] cellIdsBad = null; - String[] cellIdsPoor = null; - Set<String> nodeIdsBad = new HashSet<String>(); - Set<String> nodeIdsPoor = new HashSet<String>(); - - if (nodeIdBad != null) { - cellIdsBad = nodeIdBad.split(","); - for (int a = 0; a < cellIdsBad.length; a++) { - nodeIdsBad.add(cellIdsBad[a].trim()); - } - } - if (nodeIdPoor != null) { - cellIdsPoor = nodeIdPoor.split(","); - for (int a = 0; a < cellIdsPoor.length; a++) { - nodeIdsPoor.add(cellIdsPoor[a].trim()); - } - } - - for (int i = 0; i < cnl.size(); i++) { - - long startTime = System.currentTimeMillis(); - List<CellDetails> cellList = new ArrayList<CellDetails>(cnl - .get(i).getCells()); - List<EventPm> data = new ArrayList<EventPm>(); - - for (int j = 0; j < cellList.size(); j++) { - - long startTimeCell = System.currentTimeMillis(); - String nodeId = cellList.get(j).getNodeId(); - EventPm event = new EventPm(); - CommonEventHeaderPm commonEventHeader = new CommonEventHeaderPm(); - commonEventHeader.setSourceName(nodeId); - commonEventHeader.setStartEpochMicrosec(System - .currentTimeMillis() * 1000); - String uuid = globalPmCellIdUuidMap.get(nodeId); - if (uuid == null) { - uuid = getUuid(); - globalPmCellIdUuidMap.put(nodeId, uuid); - } - commonEventHeader.setSourceUuid(uuid); - - Measurement measurement = new Measurement(); - measurement.setMeasurementInterval(180); - - GetNeighborList cellNbrList = generateNeighborList(nodeId); - - long startTimeCheckBadPoor = System.currentTimeMillis(); - - boolean checkBad = false; - boolean checkPoor = false; - int countBad = 0; - int countPoor = 0; - - if (nodeIdsBad.contains(nodeId)) { - checkBad = true; - countBad = (int) (cellNbrList.getCellsWithHo().size() * 0.2); - } - if (nodeIdsPoor.contains(nodeId)) { - checkPoor = true; - countPoor = (int) (cellNbrList.getCellsWithHo().size() * 0.2); - } - - long endTimeCheckBadPoor = System.currentTimeMillis(); - - List<AdditionalMeasurements> additionalMeasurements = new ArrayList<AdditionalMeasurements>(); - if (checkPoor || checkBad) { - - Collections.sort(cellNbrList.getCellsWithHo()); - - for (int k = 0; k < cellNbrList.getCellsWithHo().size(); k++) { - AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); - addMsmnt.setName(cellNbrList.getCellsWithHo() - .get(k).getNodeId()); - Map<String, String> hashMap = new HashMap<String, String>(); - hashMap.put("networkId", cellNbrList - .getCellsWithHo().get(k).getNetworkId()); - - hashMap.put(parameter1, successValue1); - - if (checkBad == true) { - - if (countBad > 0) { - log.info("countBad: " + countBad); - hashMap.put(parameter2, badValue2); - countBad--; - } else { - hashMap.put(parameter2, successValue2); - } - - } else if (checkPoor == true) { - if (countPoor > 0) { - log.info("countBad: " + countPoor); - hashMap.put(parameter2, poorValue2); - countPoor--; - } else { - hashMap.put(parameter2, successValue2); - } - - } - - addMsmnt.setHashMap(hashMap); - - additionalMeasurements.add(addMsmnt); - - } - } else { - for (int k = 0; k < cellNbrList.getCellsWithHo().size(); k++) { - AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); - addMsmnt.setName(cellNbrList.getCellsWithHo() - .get(k).getNodeId()); - Map<String, String> hashMap = new HashMap<String, String>(); - - hashMap.put("networkId", cellNbrList - .getCellsWithHo().get(k).getNetworkId()); - - hashMap.put(parameter1, successValue1); - - hashMap.put(parameter2, successValue2); - - addMsmnt.setHashMap(hashMap); - additionalMeasurements.add(addMsmnt); - } - } - - commonEventHeader.setLastEpochMicrosec(System - .currentTimeMillis() * 1000); - measurement - .setAdditionalMeasurements(additionalMeasurements); - - event.setCommonEventHeader(commonEventHeader); - event.setMeasurement(measurement); - - data.add(event); - long endTimeCell = System.currentTimeMillis(); - } - - long endTime = System.currentTimeMillis(); - log.info("Time taken for generating PM data for " - + cnl.get(i).getServerId() + " : " - + (endTime - startTime)); - PmMessage msg = new PmMessage(); - - if (data.size() > 0) { - msg.setEventPmList(data); - Gson gson = new Gson(); - String jsonStr = gson.toJson(msg); - sendPmdata(cnl.get(i).getServerId(), jsonStr); - - result.add(jsonStr); - } - - } - } catch (Exception e) { - log.info("Exception in string builder", e); - } - - return result; - } - - /** - * Sets the value for all fields in the FM data for individual cell. - * - * @param networkId - * Network Id of the cell - * @param ncServer - * Server Id of the cell - * @param cellId - * Node Id of the cell - * @param issue - * Contains the collision/confusion details of the cess - * @return returns EventFm object, with all the necessary parameters. - */ - public static EventFm setEventFm(String networkId, String ncServer, - String cellId, FmAlarmInfo issue) { - - log.info("Inside generate FmData"); - EventFm event = new EventFm(); - - try { - - CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); - FaultFields faultFields = new FaultFields(); - - commonEventHeader - .setStartEpochMicrosec(System.currentTimeMillis() * 1000); - commonEventHeader.setSourceName(cellId); - commonEventHeader.setReportingEntityName(ncServer); - - String uuid = globalFmCellIdUuidMap.get(cellId); - if (uuid == null) { - uuid = getUuid(); - globalFmCellIdUuidMap.put(cellId, uuid); - } - commonEventHeader.setSourceUuid(uuid); - - if (issue.getProblem().equals("Collision") - || issue.getProblem().equals("Confusion") - || issue.getProblem().equals("CollisionAndConfusion")) { - faultFields - .setAlarmCondition("RanPciCollisionConfusionOccurred"); - faultFields.setEventSeverity("CRITICAL"); - faultFields.setEventSourceType("other"); - faultFields.setSpecificProblem(issue.getProblem()); - - Map<String, String> alarmAdditionalInformation = new HashMap<String, String>(); - alarmAdditionalInformation.put("networkId", networkId); - alarmAdditionalInformation.put("collisions", - issue.getCollisionCount()); - alarmAdditionalInformation.put("confusions", - issue.getConfusionCount()); - - faultFields - .setAlarmAdditionalInformation(alarmAdditionalInformation); - - } - commonEventHeader - .setLastEpochMicrosec(System.currentTimeMillis() * 1000); - - event.setCommonEventHeader(commonEventHeader); - event.setFaultFields(faultFields); - - } catch (Exception e) { - log.info("Exception: ", e); - } - - return event; - - } - - /** - * It checks if the cell or any of its neighbors have collision/confusion - * issue. If there are any issues it generates the FM data for the entire - * cluster - * - * @param source - * The source from which the cell modification has been - * triggered. - * @param cell - * Details of the given cell. - * @param newNeighborList - * Neighbor list of the given cell. - */ - public void generateFmData(String source, CellDetails cell, - List<NeighborDetails> newNeighborList) { - - List<EventFm> listCellIssue = new ArrayList<EventFm>(); - Set<String> ncs = new HashSet<>(); - log.info("Generating Fm data"); - - RansimControllerDatabase rsDb = new RansimControllerDatabase(); - - FmAlarmInfo op1 = setCollisionConfusionFromFile(cell.getNodeId()); - - if (source.equals("GUI")) { - if (op1.getProblem().equals("CollisionAndConfusion") - || op1.getProblem().equals("Collision") - || op1.getProblem().equals("Confusion")) { - log.info("op1: " + op1); - EventFm lci = setEventFm(cell.getNetworkId(), - cell.getServerId(), cell.getNodeId(), op1); - listCellIssue.add(lci); - ncs.add(cell.getServerId()); - log.info("Generating Fm data for: " + cell.getNodeId()); - } - } - - for (NeighborDetails cd : newNeighborList) { - FmAlarmInfo op2 = setCollisionConfusionFromFile(cd.getNeigbor() - .getNeighborCell()); - CellDetails nbrCell = rsDb.getCellDetail(cd.getNeigbor() - .getNeighborCell()); - - if (source.equals("GUI")) { - if (op2.getProblem().equals("CollisionAndConfusion") - || op2.getProblem().equals("Collision") - || op2.getProblem().equals("Confusion")) { - EventFm lci = setEventFm(nbrCell.getNetworkId(), - nbrCell.getServerId(), nbrCell.getNodeId(), op2); - log.info("FmData added:" + nbrCell.getNodeId()); - listCellIssue.add(lci); - ncs.add(nbrCell.getServerId()); - log.info("Generating Fm data for: " + nbrCell.getNodeId()); - } - } - - } - - if (source.equals("GUI")) { - for (String nc : ncs) { - - FmMessage fmDataMessage = new FmMessage(); - List<EventFm> data = new ArrayList<EventFm>(); - log.info("listCellIssue.size(): " + listCellIssue.size()); - for (EventFm cellIssue : listCellIssue) { - if (cellIssue.getCommonEventHeader() - .getReportingEntityName().equals(nc)) { - data.add(cellIssue); - if (!cellsWithIssues.contains(cellIssue - .getCommonEventHeader().getSourceName())) { - cellsWithIssues.add(cellIssue - .getCommonEventHeader().getSourceName()); - } - - } - } - log.info("data.size(): " + data.size()); - - if (data.size() > 0) { - fmDataMessage.setFmEventList(data); - log.info("Sending FM message: "); - sendFmData(nc, fmDataMessage); - } - - } - } - - } - - /** - * Sends the FM data message to the netconf agent through the ransim - * websocket server. - * - * @param serverId - * server id of the netconf agent - * @param fmDataMessage - * FM message to be sent - */ - public void sendFmData(String serverId, FmMessage fmDataMessage) { - - log.info("inside sendFmData"); - Gson gson = new Gson(); - String jsonStr = gson.toJson(fmDataMessage); - - log.info("Fm Data jsonStr: " + jsonStr); - - String ipPort = rsCtrlr.serverIdIpPortMapping.get(serverId); - - if (ipPort != null && !ipPort.trim().equals("")) { - - String[] ipPortArr = ipPort.split(":"); - log.info("Connection estabilished with ip: " + ipPort); - if (ipPort != null && !ipPort.trim().equals("")) { - Session clSess = rsCtrlr.webSocketSessions.get(ipPort); - if (clSess != null) { - log.info("FM message sent."); - RansimWebSocketServer.sendFmMessage(jsonStr, clSess); - } else { - log.info("No client session for " + ipPort); - } - } else { - log.info("No client for " + serverId); - } - } else { - log.info("No client for "); - } - - } - -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java new file mode 100644 index 0000000..a9aaf2f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.exceptions; + +public class RansimException extends Throwable { + + public RansimException() { + super(); + } + + public RansimException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + + public RansimException(String message, Throwable cause) { + super(message, cause); + } + + public RansimException(String message) { + super(message); + } + + public RansimException(Throwable cause) { + super(cause); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java new file mode 100644 index 0000000..881d19b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimPciHandler.java @@ -0,0 +1,900 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.handler; + +import com.google.gson.Gson; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import javax.websocket.Session; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.models.CellDetails; +import org.onap.ransim.rest.api.models.CellNeighbor; +import org.onap.ransim.rest.api.models.FmAlarmInfo; +import org.onap.ransim.rest.api.models.GetNeighborList; +import org.onap.ransim.rest.api.models.NeighborDetails; +import org.onap.ransim.rest.api.models.NetconfServers; +import org.onap.ransim.rest.api.models.OperationLog; +import org.onap.ransim.rest.api.models.PmDataDump; +import org.onap.ransim.rest.api.models.PmParameters; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RansimRepositoryService; +import org.onap.ransim.websocket.model.AdditionalMeasurements; +import org.onap.ransim.websocket.model.CommonEventHeaderFm; +import org.onap.ransim.websocket.model.CommonEventHeaderPm; +import org.onap.ransim.websocket.model.EventFm; +import org.onap.ransim.websocket.model.EventPm; +import org.onap.ransim.websocket.model.FaultFields; +import org.onap.ransim.websocket.model.FmMessage; +import org.onap.ransim.websocket.model.Measurement; +import org.onap.ransim.websocket.model.PmMessage; +import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class RansimPciHandler { + + static Logger log = Logger.getLogger(RansimPciHandler.class.getName()); + + @Autowired + RansimRepositoryService ransimRepo; + + @Autowired + RansimControllerServices rscServices; + + @Autowired + RANSliceConfigService ranSliceConfigService; + + static Map<String, String> globalFmCellIdUuidMap = new ConcurrentHashMap<String, String>(); + static Map<String, String> globalPmCellIdUuidMap = new ConcurrentHashMap<String, String>(); + + Set<String> cellsWithIssues = new HashSet<>(); + + List<PmParameters> pmParameters = new ArrayList<PmParameters>(); + int next = 0; + + public FmAlarmInfo setCollisionConfusionFromFile(String cellNodeId) { + + FmAlarmInfo result = new FmAlarmInfo(); + + try { + + boolean collisionDetected = false; + boolean confusionDetected = false; + List<Long> nbrPcis = new ArrayList<Long>(); + List<Long> ConfusionPcis = new ArrayList<Long>(); + int collisionCount = 0; + int confusionCount = 0; + CellDetails currentCell = ransimRepo.getCellDetail(cellNodeId); + log.info("Setting confusion/collision for Cell :" + cellNodeId); + + GetNeighborList cellNbrDetails = generateNeighborList(cellNodeId); + + for (CellDetails firstLevelNbr : cellNbrDetails.getCellsWithHo()) { + if (nbrPcis.contains((Long) firstLevelNbr.getPhysicalCellId())) { + confusionDetected = true; + if (ConfusionPcis.contains(firstLevelNbr.getPhysicalCellId())) { + confusionCount++; + } else { + ConfusionPcis.add(firstLevelNbr.getPhysicalCellId()); + confusionCount = confusionCount + 2; + } + + } else { + nbrPcis.add((Long) firstLevelNbr.getPhysicalCellId()); + } + + if (currentCell.getPhysicalCellId() == firstLevelNbr.getPhysicalCellId()) { + collisionDetected = true; + collisionCount++; + } + } + + currentCell.setPciCollisionDetected(collisionDetected); + currentCell.setPciConfusionDetected(confusionDetected); + + if (!currentCell.isPciCollisionDetected() && !currentCell.isPciConfusionDetected()) { + currentCell.setColor("#BFBFBF"); // GREY - No Issues + result.setProblem("No Issues"); + } else if (currentCell.isPciCollisionDetected() && currentCell.isPciConfusionDetected()) { + currentCell.setColor("#C30000"); // BROWN - Cell has both + // collision & confusion + result.setProblem("CollisionAndConfusion"); + + } else if (currentCell.isPciCollisionDetected()) { + currentCell.setColor("#FF0000"); // RED - Cell has collision + result.setProblem("Collision"); + + } else if (currentCell.isPciConfusionDetected()) { + currentCell.setColor("#E88B00"); // ORANGE - Cell has confusion + result.setProblem("Confusion"); + + } else { + currentCell.setColor("#BFBFBF"); // GREY - No Issues + result.setProblem("No Issues"); + } + + result.setCollisionCount("" + collisionCount); + result.setConfusionCount("" + confusionCount); + + ransimRepo.mergeCellDetails(currentCell); + + return result; + + } catch (Exception e2) { + log.info("setCollisionConfusionFromFile :", e2); + + return null; + } + + } + + /** + * Generates separate list of neighbors with and without hand-off for a + * cell. + * + * @param nodeId + * Node Id of cell for which the neighbor list is generated + * @return Returns GetNeighborList object + */ + public GetNeighborList generateNeighborList(String nodeId) { + + try { + log.info("inside generateNeighborList for: " + nodeId); + CellNeighbor neighborList = ransimRepo.getCellNeighbor(nodeId); + GetNeighborList result = new GetNeighborList(); + neighborList.display(); + List<CellDetails> cellsWithNoHO = new ArrayList<CellDetails>(); + List<CellDetails> cellsWithHO = new ArrayList<CellDetails>(); + + List<NeighborDetails> nbrList = new ArrayList<>(); + if (neighborList != null) { + nbrList.addAll(neighborList.getNeighborList()); + } + + for (int i = 0; i < nbrList.size(); i++) { + + CellDetails nbr = ransimRepo.getCellDetail(nbrList.get(i).getNeigbor().getNeighborCell()); + + if (nbrList.get(i).isBlacklisted()) { + cellsWithNoHO.add(nbr); + } else { + cellsWithHO.add(nbr); + } + + } + + result.setNodeId(nodeId); + result.setCellsWithHo(cellsWithHO); + result.setCellsWithNoHo(cellsWithNoHO); + return result; + + } catch (Exception eu) { + log.info("/getNeighborList", eu); + return null; + } + } + + public void checkCollisionAfterModify() { + try { + List<CellDetails> checkCollisionConfusion = ransimRepo.getCellsWithCollisionOrConfusion(); + + for (int i = 0; i < checkCollisionConfusion.size(); i++) { + log.info(checkCollisionConfusion.get(i).getNodeId()); + setCollisionConfusionFromFile(checkCollisionConfusion.get(i).getNodeId()); + } + } catch (Exception eu) { + log.info("checkCollisionAfterModify", eu); + } + } + + /** + * It updates the cell with its new neighbor list and PCI and updates the + * change in a database. + * + * @param nodeId + * node Id of the cell + * @param physicalCellId + * PCI number of the cell + * @param newNbrs + * List of new neighbors for the cell + * @param source + * The source from which cell modification has been triggered + * @return returns success or failure message + */ + public int modifyCellFunction(String nodeId, long physicalCellId, List<NeighborDetails> newNbrs, String source) { + + int result = 111; + + log.info("modifyCellFunction nodeId:" + nodeId + ", physicalCellId:" + physicalCellId); + CellDetails modifyCell = ransimRepo.getCellDetail(nodeId); + + if (modifyCell != null) { + if (physicalCellId < 0 || physicalCellId > RansimControllerServices.maxPciValueAllowed) { + log.info("NewPhysicalCellId is empty or invalid"); + result = 400; + } else { + long oldPciId = modifyCell.getPhysicalCellId(); + if (physicalCellId != oldPciId) { + updatePciOperationsTable(nodeId, source, physicalCellId, oldPciId); + + modifyCell.setPhysicalCellId(physicalCellId); + ransimRepo.mergeCellDetails(modifyCell); + } + + CellNeighbor neighbors = ransimRepo.getCellNeighbor(nodeId); + List<NeighborDetails> oldNbrList = new ArrayList<NeighborDetails>(neighbors.getNeighborList()); + List<NeighborDetails> oldNbrListWithHo = new ArrayList<NeighborDetails>(); + + for (NeighborDetails cell : oldNbrList) { + if (!cell.isBlacklisted()) { + oldNbrListWithHo.add(cell); + } + } + + boolean flag = false; + + List<NeighborDetails> addedNbrs = new ArrayList<NeighborDetails>(); + List<NeighborDetails> deletedNbrs = new ArrayList<NeighborDetails>(); + + String nbrsDel = ""; + + List<String> oldNbrsArr = new ArrayList<String>(); + for (NeighborDetails cell : oldNbrListWithHo) { + oldNbrsArr.add(cell.getNeigbor().getNeighborCell()); + } + + List<String> newNbrsArr = new ArrayList<String>(); + for (NeighborDetails cell : newNbrs) { + newNbrsArr.add(cell.getNeigbor().getNeighborCell()); + } + + for (NeighborDetails cell : oldNbrListWithHo) { + + if (!newNbrsArr.contains(cell.getNeigbor().getNeighborCell())) { + if (!flag) { + flag = true; + } + deletedNbrs.add(cell); + if (nbrsDel == "") { + nbrsDel = cell.getNeigbor().getNeighborCell(); + } else { + nbrsDel += "," + cell.getNeigbor().getNeighborCell(); + } + log.info("deleted cell: " + cell.getNeigbor().getNeighborCell() + cell.isBlacklisted()); + + } + } + + String nbrsAdd = ""; + + for (NeighborDetails cell : newNbrs) { + if (cell.isBlacklisted()) { + addedNbrs.add(cell); + } else { + if (!oldNbrsArr.contains(cell.getNeigbor().getNeighborCell())) { + addedNbrs.add(cell); + if (nbrsAdd == "") { + nbrsAdd = cell.getNeigbor().getNeighborCell(); + } else { + nbrsAdd += "," + cell.getNeigbor().getNeighborCell(); + } + log.info("added cell: " + cell.getNeigbor().getNeighborCell() + cell.isBlacklisted()); + } + } + + } + List<NeighborDetails> newNeighborList = new ArrayList<NeighborDetails>(oldNbrList); + for (NeighborDetails cell : deletedNbrs) { + NeighborDetails removeHo = new NeighborDetails(cell.getNeigbor(), true); + ransimRepo.mergeNeighborDetails(removeHo); + newNeighborList.add(removeHo); + } + + for (NeighborDetails cell : addedNbrs) { + ransimRepo.mergeNeighborDetails(cell); + newNeighborList.add(cell); + } + + if (!flag) { + if (newNbrs.size() != oldNbrList.size()) { + flag = true; + } + } + + if (flag) { + updateNbrsOperationsTable(nodeId, source, nbrsAdd, nbrsDel); + } + + if (newNbrs != null) { + neighbors.getNeighborList().clear(); + Set<NeighborDetails> updatedNbrList = new HashSet<NeighborDetails>(newNeighborList); + neighbors.setNeighborList(updatedNbrList); + ransimRepo.mergeCellNeighbor(neighbors); + } + + generateFmData(source, modifyCell, newNeighborList); + + result = 200; + } + + } else { + result = 400; + } + + return result; + } + + public void checkCellsWithIssue() { + + try { + + for (String id : cellsWithIssues) { + CellDetails currentCell = ransimRepo.getCellDetail(id); + FmMessage fmDataMessage = new FmMessage(); + List<EventFm> data = new ArrayList<EventFm>(); + + if (!currentCell.isPciCollisionDetected()) { + if (!currentCell.isPciConfusionDetected()) { + + cellsWithIssues.remove(id); + CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); + FaultFields faultFields = new FaultFields(); + + commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + commonEventHeader.setSourceName(currentCell.getNodeId()); + commonEventHeader.setReportingEntityName(currentCell.getServerId()); + String uuid = globalFmCellIdUuidMap.get(currentCell.getNodeId()); + commonEventHeader.setSourceUuid(uuid); + + faultFields.setAlarmCondition("RanPciCollisionConfusionOccurred"); + faultFields.setEventSeverity("NORMAL"); + faultFields.setEventSourceType("other"); + faultFields.setSpecificProblem("Problem Solved"); + + commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + + EventFm event = new EventFm(); + event.setCommonEventHeader(commonEventHeader); + event.setFaultFields(faultFields); + + data.add(event); + } + } + + fmDataMessage.setFmEventList(data); + + if (!data.isEmpty()) { + sendFmData(currentCell.getServerId(), fmDataMessage); + } + + } + + } catch (Exception eu) { + log.error("Exception:", eu); + } + } + + public void updatePciOperationsTable(String nodeId, String source, long physicalCellId, long oldPciId) { + + OperationLog operationLog = new OperationLog(); + + operationLog.setNodeId(nodeId); + operationLog.setFieldName("PCID"); + operationLog.setOperation("Modify"); + operationLog.setSource(source); + operationLog.setTime(System.currentTimeMillis()); + operationLog.setMessage("PCID value changed from " + oldPciId + " to " + physicalCellId); + ransimRepo.mergeOperationLog(operationLog); + } + + public void updateNbrsOperationsTable(String nodeId, String source, String addedNbrs, String deletedNbrs) { + + OperationLog operationLogNbrChng = new OperationLog(); + operationLogNbrChng.setNodeId(nodeId); + operationLogNbrChng.setFieldName("Neighbors"); + operationLogNbrChng.setOperation("Modify"); + operationLogNbrChng.setSource(source); + + log.info(" Neighbors added " + addedNbrs + "."); + log.info(" Neighbors removed " + deletedNbrs + "."); + String message = ""; + if (!addedNbrs.equals("")) { + message += " Neighbors added " + addedNbrs + "."; + } + + if (!deletedNbrs.equals("")) { + message += " Neighbors removed " + deletedNbrs + "."; + } + + operationLogNbrChng.setMessage(message); + operationLogNbrChng.setTime(System.currentTimeMillis()); + ransimRepo.mergeOperationLog(operationLogNbrChng); + } + + /** + * Sends PM message to the netconf agent through the websocket server. + * + * @param serverId + * Netconf agent - Server ID to which the message is sent. + * @param pmMessage + * PM message to be sent. + */ + void sendPmdata(String serverId, String pmMessage) { + + log.info("Sending PM message to netconf agent"); + + String ipPort = RansimControllerServices.serverIdIpPortMapping.get(serverId); + + if (ipPort != null && !ipPort.trim().equals("")) { + + if (ipPort != null && !ipPort.trim().equals("")) { + + Session clSess = RansimControllerServices.webSocketSessions.get(ipPort); + log.info("PM message. Netconf agent IP:" + ipPort); + if (clSess != null) { + RansimWebSocketServer.sendPmMessage(pmMessage, clSess); + log.info("Pm Data jsonStr: " + pmMessage); + log.info("PM message sent to netconf agent"); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("Pm message not sent, ipPort is null"); + } + } else { + + log.info("Pm message not sent, ipPort is null. Server Id: " + serverId); + } + + } + + /** + * + * Reads the values PM parameter values from a dump file. + * + */ + public void readPmParameters() { + + File dumpFile = null; + PmDataDump pmDump = null; + String jsonString = ""; + dumpFile = new File("PM_Kpi_Data.json"); + + BufferedReader br = null; + + try { + log.info("Reading dump file"); + br = new BufferedReader(new FileReader(dumpFile)); + + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + jsonString = sb.toString(); + + pmDump = new Gson().fromJson(jsonString, PmDataDump.class); + log.info("Dump value: " + pmDump.getKpiDump().get(0).getParameter1()); + pmParameters = new ArrayList<PmParameters>(pmDump.getKpiDump()); + + } catch (Exception eu) { + log.info("Exception: ", eu); + } + } + + private static String getUuid() { + return UUID.randomUUID().toString(); + } + + /** + * Sets values for all the parameters in the PM message + * + * @param nodeIdBad + * List of node Ids with bad performance values + * @param nodeIdPoor + * List of node Ids with poor performance values + * @return It returns the pm message + */ + @Transactional + public List<String> generatePmData(String nodeIdBad, String nodeIdPoor) { + + List<String> result = new ArrayList<>(); + + String parameter1 = ""; + String successValue1 = ""; + String badValue1 = ""; + String poorValue1 = ""; + String parameter2 = ""; + String successValue2 = ""; + String badValue2 = ""; + String poorValue2 = ""; + + try { + + if (next >= pmParameters.size()) { + next = 0; + log.info("next : " + next); + } + try { + log.info("next : " + next); + parameter1 = pmParameters.get(next).getParameter1(); + successValue1 = pmParameters.get(next).getSuccessValue1(); + badValue1 = pmParameters.get(next).getBadValue1(); + poorValue1 = pmParameters.get(next).getPoorValue1(); + parameter2 = pmParameters.get(next).getParameter2(); + successValue2 = pmParameters.get(next).getSuccessValue2(); + badValue2 = pmParameters.get(next).getBadValue2(); + poorValue2 = pmParameters.get(next).getPoorValue2(); + next++; + } catch (Exception e) { + log.info("Exception: ", e); + } + + List<NetconfServers> cnl = ransimRepo.getNetconfServersList(); + log.debug("obtained data from db"); + String[] cellIdsBad = null; + String[] cellIdsPoor = null; + Set<String> nodeIdsBad = new HashSet<String>(); + Set<String> nodeIdsPoor = new HashSet<String>(); + + if (nodeIdBad != null) { + cellIdsBad = nodeIdBad.split(","); + for (int a = 0; a < cellIdsBad.length; a++) { + nodeIdsBad.add(cellIdsBad[a].trim()); + } + } + if (nodeIdPoor != null) { + cellIdsPoor = nodeIdPoor.split(","); + for (int a = 0; a < cellIdsPoor.length; a++) { + nodeIdsPoor.add(cellIdsPoor[a].trim()); + } + } + + for (int i = 0; i < cnl.size(); i++) { + + long startTime = System.currentTimeMillis(); + List<CellDetails> cellList = new ArrayList<CellDetails>(cnl.get(i).getCells()); + List<EventPm> data = new ArrayList<EventPm>(); + + for (int j = 0; j < cellList.size(); j++) { + + long startTimeCell = System.currentTimeMillis(); + String nodeId = cellList.get(j).getNodeId(); + EventPm event = new EventPm(); + CommonEventHeaderPm commonEventHeader = new CommonEventHeaderPm(); + commonEventHeader.setSourceName(nodeId); + commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + String uuid = globalPmCellIdUuidMap.get(nodeId); + if (uuid == null) { + uuid = getUuid(); + globalPmCellIdUuidMap.put(nodeId, uuid); + } + commonEventHeader.setSourceUuid(uuid); + + Measurement measurement = new Measurement(); + measurement.setMeasurementInterval(180); + + GetNeighborList cellNbrList = generateNeighborList(nodeId); + + long startTimeCheckBadPoor = System.currentTimeMillis(); + + boolean checkBad = false; + boolean checkPoor = false; + int countBad = 0; + int countPoor = 0; + + if (nodeIdsBad.contains(nodeId)) { + checkBad = true; + countBad = (int) (cellNbrList.getCellsWithHo().size() * 0.2); + } + if (nodeIdsPoor.contains(nodeId)) { + checkPoor = true; + countPoor = (int) (cellNbrList.getCellsWithHo().size() * 0.2); + } + + long endTimeCheckBadPoor = System.currentTimeMillis(); + log.debug("Time taken CheckBadPoor : " + (endTimeCheckBadPoor - startTimeCheckBadPoor)); + List<AdditionalMeasurements> additionalMeasurements = new ArrayList<AdditionalMeasurements>(); + if (checkPoor || checkBad) { + + Collections.sort(cellNbrList.getCellsWithHo()); + + for (int k = 0; k < cellNbrList.getCellsWithHo().size(); k++) { + AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); + addMsmnt.setName(cellNbrList.getCellsWithHo().get(k).getNodeId()); + Map<String, String> hashMap = new HashMap<String, String>(); + hashMap.put("networkId", cellNbrList.getCellsWithHo().get(k).getNetworkId()); + + hashMap.put(parameter1, successValue1); + + if (checkBad == true) { + + if (countBad > 0) { + log.info("countBad: " + countBad); + hashMap.put(parameter2, badValue2); + countBad--; + } else { + hashMap.put(parameter2, successValue2); + } + + } else if (checkPoor == true) { + if (countPoor > 0) { + log.info("countBad: " + countPoor); + hashMap.put(parameter2, poorValue2); + countPoor--; + } else { + hashMap.put(parameter2, successValue2); + } + + } + + addMsmnt.setHashMap(hashMap); + + additionalMeasurements.add(addMsmnt); + + } + } else { + for (int k = 0; k < cellNbrList.getCellsWithHo().size(); k++) { + AdditionalMeasurements addMsmnt = new AdditionalMeasurements(); + addMsmnt.setName(cellNbrList.getCellsWithHo().get(k).getNodeId()); + Map<String, String> hashMap = new HashMap<String, String>(); + + hashMap.put("networkId", cellNbrList.getCellsWithHo().get(k).getNetworkId()); + + hashMap.put(parameter1, successValue1); + + hashMap.put(parameter2, successValue2); + + addMsmnt.setHashMap(hashMap); + additionalMeasurements.add(addMsmnt); + } + } + + commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + measurement.setAdditionalMeasurements(additionalMeasurements); + + event.setCommonEventHeader(commonEventHeader); + event.setMeasurement(measurement); + + data.add(event); + long endTimeCell = System.currentTimeMillis(); + log.debug("Time taken to Process Cell list : " + (endTimeCell - startTimeCell)); + } + + long endTime = System.currentTimeMillis(); + log.info("Time taken for generating PM data for " + cnl.get(i).getServerId() + " : " + + (endTime - startTime)); + PmMessage msg = new PmMessage(); + + if (data.size() > 0) { + msg.setEventPmList(data); + Gson gson = new Gson(); + String jsonStr = gson.toJson(msg); + sendPmdata(cnl.get(i).getServerId(), jsonStr); + + result.add(jsonStr); + } + + } + } catch (Exception e) { + log.info("Exception in string builder", e); + } + + return result; + } + + /** + * Sets the value for all fields in the FM data for individual cell. + * + * @param networkId + * Network Id of the cell + * @param ncServer + * Server Id of the cell + * @param cellId + * Node Id of the cell + * @param issue + * Contains the collision/confusion details of the cess + * @return returns EventFm object, with all the necessary parameters. + */ + public static EventFm setEventFm(String networkId, String ncServer, String cellId, FmAlarmInfo issue) { + + log.info("Inside generate FmData"); + EventFm event = new EventFm(); + + try { + + CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm(); + FaultFields faultFields = new FaultFields(); + + commonEventHeader.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + commonEventHeader.setSourceName(cellId); + commonEventHeader.setReportingEntityName(ncServer); + + String uuid = globalFmCellIdUuidMap.get(cellId); + if (uuid == null) { + uuid = getUuid(); + globalFmCellIdUuidMap.put(cellId, uuid); + } + commonEventHeader.setSourceUuid(uuid); + + if (issue.getProblem().equals("Collision") || issue.getProblem().equals("Confusion") + || issue.getProblem().equals("CollisionAndConfusion")) { + faultFields.setAlarmCondition("RanPciCollisionConfusionOccurred"); + faultFields.setEventSeverity("CRITICAL"); + faultFields.setEventSourceType("other"); + faultFields.setSpecificProblem(issue.getProblem()); + + Map<String, String> alarmAdditionalInformation = new HashMap<String, String>(); + alarmAdditionalInformation.put("networkId", networkId); + alarmAdditionalInformation.put("collisions", issue.getCollisionCount()); + alarmAdditionalInformation.put("confusions", issue.getConfusionCount()); + + faultFields.setAlarmAdditionalInformation(alarmAdditionalInformation); + + } + commonEventHeader.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + + event.setCommonEventHeader(commonEventHeader); + event.setFaultFields(faultFields); + + } catch (Exception e) { + log.info("Exception: ", e); + } + + return event; + + } + + /** + * It checks if the cell or any of its neighbors have collision/confusion + * issue. If there are any issues it generates the FM data for the entire + * cluster + * + * @param source + * The source from which the cell modification has been + * triggered. + * @param cell + * Details of the given cell. + * @param newNeighborList + * Neighbor list of the given cell. + */ + public void generateFmData(String source, CellDetails cell, List<NeighborDetails> newNeighborList) { + + List<EventFm> listCellIssue = new ArrayList<EventFm>(); + Set<String> ncs = new HashSet<>(); + log.info("Generating Fm data"); + FmAlarmInfo op1 = setCollisionConfusionFromFile(cell.getNodeId()); + + if (source.equals("GUI")) { + if (op1.getProblem().equals("CollisionAndConfusion") || op1.getProblem().equals("Collision") + || op1.getProblem().equals("Confusion")) { + log.info("op1: " + op1); + EventFm lci = setEventFm(cell.getNetworkId(), cell.getServerId(), cell.getNodeId(), op1); + listCellIssue.add(lci); + ncs.add(cell.getServerId()); + log.info("Generating Fm data for: " + cell.getNodeId()); + } + } + + for (NeighborDetails cd : newNeighborList) { + FmAlarmInfo op2 = setCollisionConfusionFromFile(cd.getNeigbor().getNeighborCell()); + CellDetails nbrCell = ransimRepo.getCellDetail(cd.getNeigbor().getNeighborCell()); + + if (source.equals("GUI")) { + if (op2.getProblem().equals("CollisionAndConfusion") || op2.getProblem().equals("Collision") + || op2.getProblem().equals("Confusion")) { + EventFm lci = setEventFm(nbrCell.getNetworkId(), nbrCell.getServerId(), nbrCell.getNodeId(), op2); + log.info("FmData added:" + nbrCell.getNodeId()); + listCellIssue.add(lci); + ncs.add(nbrCell.getServerId()); + log.info("Generating Fm data for: " + nbrCell.getNodeId()); + } + } + + } + + if (source.equals("GUI")) { + for (String nc : ncs) { + + FmMessage fmDataMessage = new FmMessage(); + List<EventFm> data = new ArrayList<EventFm>(); + log.info("listCellIssue.size(): " + listCellIssue.size()); + for (EventFm cellIssue : listCellIssue) { + if (cellIssue.getCommonEventHeader().getReportingEntityName().equals(nc)) { + data.add(cellIssue); + if (!cellsWithIssues.contains(cellIssue.getCommonEventHeader().getSourceName())) { + cellsWithIssues.add(cellIssue.getCommonEventHeader().getSourceName()); + } + + } + } + log.info("data.size(): " + data.size()); + + if (data.size() > 0) { + fmDataMessage.setFmEventList(data); + log.info("Sending FM message: "); + sendFmData(nc, fmDataMessage); + } + + } + } + + } + + /** + * Sends the FM data message to the netconf agent through the ransim + * websocket server. + * + * @param serverId + * server id of the netconf agent + * @param fmDataMessage + * FM message to be sent + */ + public void sendFmData(String serverId, FmMessage fmDataMessage) { + + log.info("inside sendFmData"); + Gson gson = new Gson(); + String jsonStr = gson.toJson(fmDataMessage); + + log.info("Fm Data jsonStr: " + jsonStr); + + String ipPort = RansimControllerServices.serverIdIpPortMapping.get(serverId); + + if (ipPort != null && !ipPort.trim().equals("")) { + + log.info("Connection estabilished with ip: " + ipPort); + if (ipPort != null && !ipPort.trim().equals("")) { + Session clSess = RansimControllerServices.webSocketSessions.get(ipPort); + if (clSess != null) { + log.info("FM message sent."); + RansimWebSocketServer.sendFmMessage(jsonStr, clSess); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("No client for " + serverId); + } + } else { + log.info("No client for "); + } + + } + +} 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 new file mode 100644 index 0000000..4629fc6 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java @@ -0,0 +1,259 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.handler; + +import com.google.gson.Gson; + +import java.io.File; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import javax.websocket.Session; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RansimRepositoryService; +import org.onap.ransim.rest.web.mapper.GNBCUCPModel; +import org.onap.ransim.rest.web.mapper.NRCellCUModel; +import org.onap.ransim.rest.web.mapper.PLMNInfoModel; +import org.onap.ransim.rest.xml.models.*; +import org.onap.ransim.websocket.model.SlicingPmMessage; +import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class RansimSlicingHandler { + + static Logger log = Logger.getLogger(RansimSlicingHandler.class.getName()); + + @Autowired + RansimRepositoryService ransimRepo; + + @Autowired + RansimControllerServices rscServices; + + @Autowired + RANSliceConfigService ranSliceConfigService; + + public List<String> generateIntelligentSlicingPmData(long startTime, HashMap<String, List<String>> taCells) { + List<String> result = new ArrayList<String>(); + try { + String requestUrl = "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/cucp-list"; + List<GNBCUCPModel> gnbcucpModelList = sendGetRequestToConfigDb(requestUrl).getBody(); + long peakEndTime = System.currentTimeMillis() + 360000; + for (int i = 0; i < gnbcucpModelList.size(); i++) { + String gNBName = gnbcucpModelList.get(i).getgNBCUName(); + LocalDateTime beginTime = LocalDateTime.now(); + String beginTimeString = beginTime.toString(); + SlicingPmMessage pmMessage = new SlicingPmMessage(); + pmMessage.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + pmMessage.setSourceName(gNBName); + MeasCollec measCollec = new MeasCollec(beginTimeString); + FileSender fileSender = new FileSender(gNBName); + FileHeader fileHeader = new FileHeader("Prefix", "Acme Ltd", "32.435 V10.0", measCollec, fileSender); + Random r = new Random(); + int jobId = r.nextInt((9999 - 1000) + 1) + 1000; + Job job = new Job(String.valueOf(jobId)); + ReportingPeriod reportingPeriod = new ReportingPeriod("PT900S"); + List<MeasType> measTypeList = new ArrayList<MeasType>(); + int numberOfNssaiType = 1; + HashMap<String, Integer> nssaiInfoMap = new HashMap<String, Integer>(); + for (NRCellCUModel nRCellCUModel : gnbcucpModelList.get(i).getCellCUList()) { + for (PLMNInfoModel pLMNInfoModel : nRCellCUModel.getpLMNInfoList()) { + if (pLMNInfoModel.getsNSSAI().getStatus().equalsIgnoreCase("active")) { + nssaiInfoMap.put(pLMNInfoModel.getsNSSAI().getsNSSAI(), + pLMNInfoModel.getsNSSAI().getConfigData().getMaxNumberOfConns()); + } + } + } + HashMap<String, Integer> nSSAINo = new HashMap<String, Integer>(); + for (java.util.Map.Entry<String, Integer> map : nssaiInfoMap.entrySet()) { + String nssai = map.getKey(); + MeasType mesType1 = new MeasType("SM.PDUSessionSetupReq." + nssai, numberOfNssaiType++); + MeasType mesType2 = new MeasType("SM.PDUSessionSetupSucc." + nssai, numberOfNssaiType++); + measTypeList.add(mesType1); + measTypeList.add(mesType2); + if (numberOfNssaiType == 3) { + MeasType mesTypeFail = new MeasType("SM.PDUSessionSetupFail." + "0", 3); + measTypeList.add(mesTypeFail); + numberOfNssaiType++; + } + nSSAINo.put(nssai, mesType1.getP()); + } + + List<MeasValue> measValueList = new ArrayList<MeasValue>(); + + for (NRCellCUModel nRCellCUModel : gnbcucpModelList.get(i).getCellCUList()) { + List<Result> resultList = new ArrayList<Result>(); + int noOfRequestedSessions = 0; + int successfulSessions = 0; + int failedSessions = 0; + int configData = 0; + double rNumForTotalReq = 0; + int numberOfNssaiValue = 1; // change + for (PLMNInfoModel pLMNInfoModel : nRCellCUModel.getpLMNInfoList()) { + for (java.util.Map.Entry<String, Integer> nssaiMap : nSSAINo.entrySet()) { + if (nssaiMap.getKey().equals(pLMNInfoModel.getsNSSAI().getsNSSAI())) { + configData = pLMNInfoModel.getsNSSAI().getConfigData().getMaxNumberOfConns(); + noOfRequestedSessions = 0; + successfulSessions = 0; + for (java.util.Map.Entry<String, List<String>> taCellMap : taCells.entrySet()) { + for (String cell : taCellMap.getValue()) { + if (Integer.parseInt(cell) == nRCellCUModel.getCellLocalId().intValue()) { + long end = (System.currentTimeMillis()); + if (peakEndTime > end) { + if (taCellMap.getKey().equalsIgnoreCase("TA1") + || taCellMap.getKey().equalsIgnoreCase("TA3")) { + rNumForTotalReq = 1.4 + (new Random().nextDouble() * (1.0 - 1.4)); + } else { + rNumForTotalReq = 0.6 + (new Random().nextDouble() * (0.3 - 0.6)); + } + } else { + rNumForTotalReq = 0.7 + (new Random().nextDouble() * (0.3 - 0.7)); + } + } + } + } + + double rNumForFs = 0.10 + (new Random().nextDouble() * (0.05 - 0.10)); + double rNumForSs = 0.75 + (new Random().nextDouble() * (0.75 - 0.90)); + noOfRequestedSessions = (int) (configData * rNumForTotalReq); + successfulSessions = (int) (noOfRequestedSessions * rNumForSs); + failedSessions += noOfRequestedSessions - successfulSessions; + numberOfNssaiValue = nssaiMap.getValue(); + Result result1 = new Result(numberOfNssaiValue++, noOfRequestedSessions); + Result result2 = new Result(numberOfNssaiValue++, successfulSessions); + resultList.add(result1); + resultList.add(result2); + if (numberOfNssaiValue == 3) { + numberOfNssaiValue++; + } + if (nRCellCUModel.getpLMNInfoList().indexOf(pLMNInfoModel) + 1 == nRCellCUModel + .getpLMNInfoList().size()) { + failedSessions -= failedSessions * rNumForFs; + Result result3 = new Result(3, failedSessions); + resultList.add(result3); + } + } + } + + } + + MeasValue measValue = new MeasValue(nRCellCUModel.getCellLocalId(), resultList, false); + measValueList.add(measValue); + } + + ManagedElement managedElement = new ManagedElement("r0.1", gNBName); + LocalDateTime grabularityEndTime = LocalDateTime.now(); + String grabularityEndTimeString = grabularityEndTime.toString(); + GranularityPeriod granularityPeriod = new GranularityPeriod(grabularityEndTimeString, "PT900S"); + MeasInfo measInfo = new MeasInfo("measInfoIsVal", job, granularityPeriod, reportingPeriod, measTypeList, + measValueList); + List<MeasInfo> measInfoList = new ArrayList<MeasInfo>(); + measInfoList.add(measInfo); + MeasData measData = new MeasData(managedElement, measInfoList); + List<MeasData> measDataList = new ArrayList<MeasData>(); + measDataList.add(measData); + LocalDateTime endTime = LocalDateTime.now(); + String endTimeString = endTime.toString(); + pmMessage.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + MeasCollecEnd measCollecEnd = new MeasCollecEnd(endTimeString); + FileFooter fileFooter = new FileFooter(measCollecEnd); + MeasCollecFile measCollecFile = new MeasCollecFile(fileHeader, measDataList, fileFooter, + "http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"); + String startDate = beginTimeString.replace(':', '-'); + String endDate = endTimeString.replace(':', '-'); + String fileName = + "A" + startDate + "-" + endDate + "-" + String.valueOf(jobId) + "-" + gNBName + ".xml"; + pmMessage.setFileName(fileName); + Gson gson = new Gson(); + String pmData = gson.toJson(measCollecFile); + pmMessage.setPmData(pmData); + sendIntelligentSlicingPmData(pmMessage); + } + } catch (Exception e) { + System.out.println("Exception: " + e); + } + return result; + } + + public static <T> ResponseEntity<List<GNBCUCPModel>> sendGetRequestToConfigDb(String requestUrl) { + + HttpHeaders headers = new HttpHeaders(); + log.info("sending..."); + headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); + HttpEntity<Void> requestEntity = new HttpEntity<>(headers); + try { + RestTemplate restTemplate = new RestTemplate(); + return restTemplate.exchange(requestUrl, HttpMethod.GET, requestEntity, + new ParameterizedTypeReference<List<GNBCUCPModel>>() {}); + } catch (Exception e) { + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } + } + + public void sendIntelligentSlicingPmData(SlicingPmMessage pmMessage) { + + log.info("inside sendIntelligentSlicingPmData"); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(pmMessage); + + log.info("IntelligentSlicingPmData " + jsonStr); + + String ipPort = RansimControllerServices.serverIdIpPortMapping.get(pmMessage.getSourceName()); + + if (ipPort != null && !ipPort.trim().equals("")) { + + log.info("Connection estabilished with ip: " + ipPort); + if (ipPort != null && !ipPort.trim().equals("")) { + Session clSess = RansimControllerServices.webSocketSessions.get(ipPort); + if (clSess != null) { + log.info("PM Data message sent."); + RansimWebSocketServer.sendIntelligentSlicingPmData(jsonStr, clSess); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("No client for this serverId"); + } + } else { + log.info("No client for "); + } + + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java index 3d9a70c..f6c7401 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellData.java @@ -23,42 +23,40 @@ package org.onap.ransim.rest.api.models; import java.util.List; public class CellData { - + private CellInfo Cell; private List<NbrDump> neighbor; - + public CellData() { super(); } - + /** * Constructor with all parameters - * - * @param cell - * Contains cell details. - * @param neighbor - * Contains list of neighbor details. + * + * @param cell Contains cell details. + * @param neighbor Contains list of neighbor details. */ public CellData(CellInfo cell, List<NbrDump> neighbor) { super(); Cell = cell; this.neighbor = neighbor; } - + public CellInfo getCell() { return Cell; } - + public void setCell(CellInfo cell) { Cell = cell; } - + public List<NbrDump> getNeighbor() { return neighbor; } - + public void setNeighbor(List<NbrDump> neighbor) { this.neighbor = neighbor; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java index 697744c..c50a097 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellDetails.java @@ -27,8 +27,8 @@ import javax.persistence.Table; @Entity @Table(name = "CellDetails") -public class CellDetails implements Comparable<CellDetails>{ - +public class CellDetails implements Comparable<CellDetails> { + private String networkId; private String nodeId; private long physicalCellId; @@ -45,16 +45,13 @@ public class CellDetails implements Comparable<CellDetails>{ private String serverId; private int sectorNumber = 0; private String color; - + /** * Constructor with cell Id, pci and server Id for test cases. - * - * @param nodeId - * Node Id of Cell - * @param physicalCellId - * Pci value of the cell. - * @param serverId - * Server Id of the cell. + * + * @param nodeId Node Id of Cell + * @param physicalCellId Pci value of the cell. + * @param serverId Server Id of the cell. */ public CellDetails(String nodeId, long physicalCellId, String serverId) { super(); @@ -62,48 +59,31 @@ public class CellDetails implements Comparable<CellDetails>{ this.physicalCellId = physicalCellId; this.serverId = serverId; } - + /** * A constructor for CellDetails( Database to store cell details). * - * @param networkId - * network Id of the cell - * @param nodeId - * node Id of the cell - * @param physicalCellId - * PCI number of the cell - * @param nodeName - * node name - * @param nodeType - * node type based on the cluster - * @param pciCollisionDetected - * Checks if the cell has collision - * @param pciConfusionDetected - * Checks if the cell has confusion + * @param networkId network Id of the cell + * @param nodeId node Id of the cell + * @param physicalCellId PCI number of the cell + * @param nodeName node name + * @param nodeType node type based on the cluster + * @param pciCollisionDetected Checks if the cell has collision + * @param pciConfusionDetected Checks if the cell has confusion * - * @param gridX - * -- - * @param gridY - * -- - * @param screenX - * x coordinate of the cell in the GUI - * @param screenY - * y coordinate of the cell in the GUI - * @param latitude - * latitude of the cell node - * @param longitude - * longitude of the cell node - * @param serverId - * server Id of the netconf server it belongs to - * @param sectorNumber - * sector number of the cell - * @param color - * color of the cell in the GUI + * @param gridX -- + * @param gridY -- + * @param screenX x coordinate of the cell in the GUI + * @param screenY y coordinate of the cell in the GUI + * @param latitude latitude of the cell node + * @param longitude longitude of the cell node + * @param serverId server Id of the netconf server it belongs to + * @param sectorNumber sector number of the cell + * @param color color of the cell in the GUI */ - public CellDetails(String networkId, String nodeId, long physicalCellId, String nodeName, - String nodeType, boolean pciCollisionDetected, boolean pciConfusionDetected, - float gridX, float gridY, float screenX, float screenY, String latitude, - String longitude, String serverId, int sectorNumber, String color) { + public CellDetails(String networkId, String nodeId, long physicalCellId, String nodeName, String nodeType, + boolean pciCollisionDetected, boolean pciConfusionDetected, float gridX, float gridY, float screenX, + float screenY, String latitude, String longitude, String serverId, int sectorNumber, String color) { super(); this.networkId = networkId; this.nodeId = nodeId; @@ -112,7 +92,7 @@ public class CellDetails implements Comparable<CellDetails>{ this.nodeType = nodeType; this.pciCollisionDetected = pciCollisionDetected; this.pciConfusionDetected = pciConfusionDetected; - + this.gridX = gridX; this.gridY = gridY; this.screenX = screenX; @@ -123,149 +103,148 @@ public class CellDetails implements Comparable<CellDetails>{ this.sectorNumber = sectorNumber; this.color = color; } - + public CellDetails() { super(); } - + public String getNetworkId() { return networkId; } - + public void setNetworkId(String networkId) { this.networkId = networkId; } - + @Id @Column(name = "nodeId", unique = true, nullable = false, length = 50) public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public long getPhysicalCellId() { return physicalCellId; } - + public void setPhysicalCellId(long physicalCellId) { this.physicalCellId = physicalCellId; } - + public String getNodeName() { return nodeName; } - + public void setNodeName(String nodeName) { this.nodeName = nodeName; } - + public String getNodeType() { return nodeType; } - + public void setNodeType(String nodeType) { this.nodeType = nodeType; } - + public boolean isPciCollisionDetected() { return pciCollisionDetected; } - + public void setPciCollisionDetected(boolean pciCollisionDetected) { this.pciCollisionDetected = pciCollisionDetected; } - + public boolean isPciConfusionDetected() { return pciConfusionDetected; } - + public void setPciConfusionDetected(boolean pciConfusionDetected) { this.pciConfusionDetected = pciConfusionDetected; } - + public float getGridX() { return gridX; } - + public void setGridX(float gridX) { this.gridX = gridX; } - + public float getGridY() { return gridY; } - + public void setGridY(float gridY) { this.gridY = gridY; } - + public float getScreenX() { return screenX; } - + public void setScreenX(float screenX) { this.screenX = screenX; } - + public float getScreenY() { return screenY; } - + public void setScreenY(float screenY) { this.screenY = screenY; } - + public String getServerId() { return serverId; } - + public void setServerId(String serverId) { this.serverId = serverId; } - + public int getSectorNumber() { return sectorNumber; } - + public void setSectorNumber(int sectorNumber) { this.sectorNumber = sectorNumber; } - + public String getColor() { return color; } - + public void setColor(String color) { this.color = color; } - + public String getLatitude() { return latitude; } - + public void setLatitude(String latitude) { this.latitude = latitude; } - + public String getLongitude() { return longitude; } - + public void setLongitude(String longitude) { this.longitude = longitude; } - + @Override public String toString() { - return "Cell Details [networkId=" + networkId + ", nodeId=" + nodeId + ", physicalCellId=" - + physicalCellId + ", nodeName=" + nodeName + ", nodeType=" + nodeType - + ", pciCollisionDetected=" + pciCollisionDetected + ", pciConfusionDetected=" - + pciConfusionDetected + "]"; + return "Cell Details [networkId=" + networkId + ", nodeId=" + nodeId + ", physicalCellId=" + physicalCellId + + ", nodeName=" + nodeName + ", nodeType=" + nodeType + ", pciCollisionDetected=" + pciCollisionDetected + + ", pciConfusionDetected=" + pciConfusionDetected + "]"; } - + @Override public int compareTo(CellDetails cd) { return this.getNodeId().compareTo(cd.getNodeId()); diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java index e9dbbe0..4a18987 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellInfo.java @@ -21,7 +21,7 @@ package org.onap.ransim.rest.api.models; public class CellInfo { - + private String networkId; private String nodeId; private long physicalCellId; @@ -29,27 +29,20 @@ public class CellInfo { private int sectorNumber; private String latitude; private String longitude; - + /** * A constructor for CellInfo. * - * @param networkId - * network Id of the cell - * @param nodeId - * node Id of the cell - * @param physicalCellId - * PCI number of the cell - * @param pnfName - * netconf server id - * @param sectorNumber - * sector number for the cell - * @param latitude - * latitude of the node - * @param longitude - * longitude of the node + * @param networkId network Id of the cell + * @param nodeId node Id of the cell + * @param physicalCellId PCI number of the cell + * @param pnfName netconf server id + * @param sectorNumber sector number for the cell + * @param latitude latitude of the node + * @param longitude longitude of the node */ - public CellInfo(String networkId, String nodeId, long physicalCellId, - String pnfName, int sectorNumber, String latitude, String longitude) { + public CellInfo(String networkId, String nodeId, long physicalCellId, String pnfName, int sectorNumber, + String latitude, String longitude) { super(); this.networkId = networkId; this.nodeId = nodeId; @@ -59,65 +52,65 @@ public class CellInfo { this.latitude = latitude; this.longitude = longitude; } - + public CellInfo() { - + } - + public String getNetworkId() { return networkId; } - + public void setNetworkId(String networkId) { this.networkId = networkId; } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public long getPhysicalCellId() { return physicalCellId; } - + public void setPhysicalCellId(long physicalCellId) { this.physicalCellId = physicalCellId; } - + public String getPnfName() { return pnfName; } - + public void setPnfName(String pnfName) { this.pnfName = pnfName; } - + public int getSectorNumber() { return sectorNumber; } - + public void setSectorNumber(int sectorNumber) { this.sectorNumber = sectorNumber; } - + public String getLatitude() { return latitude; } - + public void setLatitude(String latitude) { this.latitude = latitude; } - + public String getLongitude() { return longitude; } - + public void setLongitude(String longitude) { this.longitude = longitude; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java index aca96ca..6c05f26 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CellNeighbor.java @@ -24,34 +24,30 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.controller.RansimControllerServices; +import org.onap.ransim.rest.api.controller.RansimController; @Entity @Table(name = "CellNeighbor") public class CellNeighbor { - + @Id @Column(name = "nodeId", unique = true, nullable = false, length = 52) private String nodeId; - - /* - * @OneToMany(targetEntity = CellDetails.class) private Set<CellDetails> - * neighborList; - */ - - @OneToMany(targetEntity = NeighborDetails.class) + + @OneToMany(targetEntity = NeighborDetails.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Set<NeighborDetails> neighborList; - + public CellNeighbor() { super(); - // TODO Auto-generated constructor stub } public CellNeighbor(String nodeId, Set<NeighborDetails> neighborList) { @@ -63,34 +59,28 @@ public class CellNeighbor { public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public Set<NeighborDetails> getNeighborList() { return neighborList; } - + public void setNeighborList(Set<NeighborDetails> neighborList) { this.neighborList = neighborList; } - - static Logger log = Logger.getLogger(RansimControllerServices.class.getName()); - + + static Logger log = Logger.getLogger(RansimController.class.getName()); + public void display() { - + List<NeighborDetails> iterator = new ArrayList<>(neighborList); for (int ii = 0; ii < iterator.size(); ii++) { - log.info("neighbors NeighborList: " - + iterator.get(ii).getNeigbor().getSourceCellNodeId() + " " - + iterator.get(ii).getNeigbor().getNeighborCell() + " " - + iterator.get(ii).isBlacklisted()); + log.info("neighbors NeighborList: " + iterator.get(ii).getNeigbor().getSourceCellNodeId() + " " + + iterator.get(ii).getNeigbor().getNeighborCell() + " " + iterator.get(ii).isBlacklisted()); } - + } - /* - * public void clearNeighborList() { this.neighborList.; } - */ - } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ConfigData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ConfigData.java new file mode 100644 index 0000000..afa454b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ConfigData.java @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +public class ConfigData { + + private int maxNumberOfConns; + + public ConfigData() { + } + + public ConfigData(int maxNumberOfConns) { + super(); + this.maxNumberOfConns = maxNumberOfConns; + } + + public int getMaxNumberOfConns() { + return maxNumberOfConns; + } + + public void setMaxNumberOfConns(int maxNumberOfConns) { + this.maxNumberOfConns = maxNumberOfConns; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java index 34e23a5..b216e5e 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/CreateACellReq.java @@ -23,57 +23,54 @@ package org.onap.ransim.rest.api.models; import java.io.Serializable; public class CreateACellReq implements Serializable { - + private long physicalCellId; - + private int gridX; private int gridY; - + private static final long serialVersionUID = 3736300675426332512L; - + public CreateACellReq() { // Default constructor for CreateACellReq } - + /** * A constructor for CreateACellReq. * - * @param physicalCellId - * PCI number of the new cell - * @param gridX - * x coordinate value for the cell - * @param gridY - * y coordinate value for the cell + * @param physicalCellId PCI number of the new cell + * @param gridX x coordinate value for the cell + * @param gridY y coordinate value for the cell */ public CreateACellReq(long physicalCellId, int gridX, int gridY) { super(); - + this.physicalCellId = physicalCellId; - + this.gridX = gridX; this.gridY = gridY; } - + public long getPhysicalCellId() { return physicalCellId; } - + public void setPhysicalCellId(long physicalCellId) { this.physicalCellId = physicalCellId; } - + public int getGridX() { return gridX; } - + public void setGridX(int gridX) { this.gridX = gridX; } - + public int getGridY() { return gridY; } - + public void setGridY(int gridY) { this.gridY = gridY; } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java index a2a01ac..7329a31 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/DeleteACellReq.java @@ -21,30 +21,29 @@ package org.onap.ransim.rest.api.models; public class DeleteACellReq { - + private String nodeId; - + /** * A constructor for DeleteACellReq. * - * @param nodeId - * node Id of the cell to be deleted + * @param nodeId node Id of the cell to be deleted */ public DeleteACellReq(String nodeId) { super(); this.nodeId = nodeId; } - + public DeleteACellReq() { - + } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java index 6a01498..2b7dd39 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/FmAlarmInfo.java @@ -21,24 +21,21 @@ package org.onap.ransim.rest.api.models; public class FmAlarmInfo { - + private String problem; private String collisionCount; private String confusionCount; - + public FmAlarmInfo() { super(); } - + /** * Constructor with all fields. - * - * @param problem - * Collision or Confusion - * @param collisionCount - * No of cells that causes collision. - * @param confusionCount - * No od cells that causes confusion. + * + * @param problem Collision or Confusion + * @param collisionCount No of cells that causes collision. + * @param confusionCount No od cells that causes confusion. */ public FmAlarmInfo(String problem, String collisionCount, String confusionCount) { super(); @@ -46,29 +43,29 @@ public class FmAlarmInfo { this.collisionCount = collisionCount; this.confusionCount = confusionCount; } - + public String getProblem() { return problem; } - + public void setProblem(String problem) { this.problem = problem; } - + public String getCollisionCount() { return collisionCount; } - + public void setCollisionCount(String collisionCount) { this.collisionCount = collisionCount; } - + public String getConfusionCount() { return confusionCount; } - + public void setConfusionCount(String confusionCount) { this.confusionCount = confusionCount; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUCPFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUCPFunction.java new file mode 100644 index 0000000..71f8b07 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUCPFunction.java @@ -0,0 +1,113 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "GNBCUCPFUNCTION") +public class GNBCUCPFunction implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "GNBCUNAME") + private String gNBCUName; + @Column(name = "GNBID") + private Integer gNBId; + @Column(name = "GNBIDLENGTH") + private Integer gNBIdLength; + @Column(name = "PLMNID") + private String pLMNId; + @Column(name = "NFTYPE") + private String nFType; + @Column(name = "CELLCULIST") + @OneToMany(mappedBy = "gNBCUCPFunction", cascade = CascadeType.ALL) + private List<NRCellCU> cellCUList; + @ManyToOne // (cascade=CascadeType.ALL) + @JoinColumn(name = "nearrtricid") + private NearRTRIC nearRTRIC; + + public String getgNBCUName() { + return gNBCUName; + } + + public void setgNBCUName(String gNBCUName) { + this.gNBCUName = gNBCUName; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public Integer getgNBIdLength() { + return gNBIdLength; + } + + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public List<NRCellCU> getCellCUList() { + return cellCUList; + } + + public void setCellCUList(List<NRCellCU> cellCUList) { + this.cellCUList = cellCUList; + } + + public NearRTRIC getNearRTRIC() { + return nearRTRIC; + } + + public void setNearRTRIC(NearRTRIC nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + + public String getnFType() { + return nFType; + } + + public void setnFType(String nFType) { + this.nFType = nFType; + } + +} 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 new file mode 100644 index 0000000..790a638 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java @@ -0,0 +1,114 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "GNBCUUPFUNCTION") +public class GNBCUUPFunction implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "GNBCUUPID") + private Integer gNBCUUPId; + @Column(name = "GNBID") + private Integer gNBId; + @Column(name = "GNBIDLENGTH") + private Integer gNBIdLength; + // @Column(name="PLMNINFOLIST") + // @OneToMany(mappedBy = "gNBCUUPFunction", + // cascade={CascadeType.PERSIST,CascadeType.REMOVE}) + @ElementCollection(fetch = FetchType.EAGER) + @CollectionTable(name = "PLMNINFO", joinColumns = @JoinColumn(name = "gnbcuupid")) + private List<PLMNInfo> pLMNInfoList; + @Column(name = "RESOURCETYPE") + private String resourceType; + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "nearrtricid") + private NearRTRIC nearRTRIC; + + public Integer getgNBCUUPId() { + return gNBCUUPId; + } + + public void setgNBCUUPId(Integer gNBCUUPId) { + this.gNBCUUPId = gNBCUUPId; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public Integer getgNBIdLength() { + return gNBIdLength; + } + + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + + public List<PLMNInfo> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfo> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + public NearRTRIC getNearRTRIC() { + return nearRTRIC; + } + + public void setNearRTRIC(NearRTRIC nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + @Override + public String toString() { + return "GNBCUUPFunction [gNBCUUPId=" + gNBCUUPId + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + + ", pLMNInfoList=" + pLMNInfoList + ", resourceType=" + resourceType + ", nearRTRIC=" + nearRTRIC + + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBDUFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBDUFunction.java new file mode 100644 index 0000000..618d61b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBDUFunction.java @@ -0,0 +1,123 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "GNBDUFUNCTION") +public class GNBDUFunction implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "GNBDUID") + private Integer gNBDUId; + @Column(name = "GNBID") + private Integer gNBId; + @Column(name = "GNBIDLENGTH") + private Integer gNBIdLength; + @Column(name = "GNBDUNAME") + private String gNBDUName; + @Column(name = "PLMNID") + private String pLMNId; + @Column(name = "NFTYPE") + private String nFType; + @Column(name = "CELLDULIST") + @OneToMany(mappedBy = "gNBDUFunction", cascade = CascadeType.ALL) + private List<NRCellDU> cellDUList; + @ManyToOne + @JoinColumn(name = "nearrtricid") + private NearRTRIC nearRTRIC; + + public Integer getgNBDUId() { + return gNBDUId; + } + + public void setgNBDUId(Integer gNBDUId) { + this.gNBDUId = gNBDUId; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public Integer getgNBIdLength() { + return gNBIdLength; + } + + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + + public String getgNBDUName() { + return gNBDUName; + } + + public void setgNBDUName(String gNBDUName) { + this.gNBDUName = gNBDUName; + } + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public List<NRCellDU> getCellDUList() { + return cellDUList; + } + + public void setCellDUList(List<NRCellDU> cellDUList) { + this.cellDUList = cellDUList; + } + + public NearRTRIC getNearRTRIC() { + return nearRTRIC; + } + + public void setNearRTRIC(NearRTRIC nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + + public String getnFType() { + return nFType; + } + + public void setnFType(String nFType) { + this.nFType = nFType; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java index a8104fe..887d3bf 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetACellDetailReq.java @@ -21,30 +21,29 @@ package org.onap.ransim.rest.api.models; public class GetACellDetailReq { - + private String nodeId; - + /** * A constructor for GetACellDetailReq. * - * @param nodeId - * node id of the cell + * @param nodeId node id of the cell */ public GetACellDetailReq(String nodeId) { super(); this.nodeId = nodeId; } - + public GetACellDetailReq() { - + } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java index 497df10..11e8019 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborList.java @@ -17,60 +17,57 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; import java.util.List; public class GetNeighborList { - + private String nodeId; private List<CellDetails> cellsWithNoHo; private List<CellDetails> cellsWithHo; - + public GetNeighborList() { super(); } - + /** * Constructor with all fields. - * - * @param nodeId - * Node Id of cell - * @param cellsWithNoHO - * List of neighbors with unsuccessful handover. - * @param cellsWithHO - * List of neighbors with successful handover. + * + * @param nodeId Node Id of cell + * @param cellsWithNoHO List of neighbors with unsuccessful handover. + * @param cellsWithHO List of neighbors with successful handover. */ - public GetNeighborList(String nodeId, List<CellDetails> cellsWithNoHo, - List<CellDetails> cellsWithHo) { + public GetNeighborList(String nodeId, List<CellDetails> cellsWithNoHo, List<CellDetails> cellsWithHo) { super(); this.nodeId = nodeId; this.cellsWithNoHo = cellsWithNoHo; this.cellsWithHo = cellsWithHo; } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public List<CellDetails> getCellsWithNoHo() { return cellsWithNoHo; } - + public void setCellsWithNoHo(List<CellDetails> cellsWithNoHo) { this.cellsWithNoHo = cellsWithNoHo; } - + public List<CellDetails> getCellsWithHo() { return cellsWithHo; } - + public void setCellsWithHo(List<CellDetails> cellsWithHo) { this.cellsWithHo = cellsWithHo; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java index 772211c..b779112 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNeighborListReq.java @@ -21,30 +21,29 @@ package org.onap.ransim.rest.api.models; public class GetNeighborListReq { - + private String nodeId; - + public GetNeighborListReq() { - + } - + /** * A constructor for GetNeighborListReq. * - * @param nodeId - * node Id of the cell who's neighbor list is required + * @param nodeId node Id of the cell who's neighbor list is required */ public GetNeighborListReq(String nodeId) { super(); this.nodeId = nodeId; } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java index baddd09..da0e410 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetNetconfServerDetailsReq.java @@ -21,31 +21,30 @@ package org.onap.ransim.rest.api.models; public class GetNetconfServerDetailsReq { - + private String serverId; - + /** * A constructor for GetNetconfServerDetailsReq. * - * @param serverId - * server Id of the netconf server + * @param serverId server Id of the netconf server */ public GetNetconfServerDetailsReq(String serverId) { super(); this.serverId = serverId; } - + public GetNetconfServerDetailsReq() { - + // TODO Auto-generated constructor stub } - + public String getServerId() { return serverId; } - + public void setServerId(String serverId) { this.serverId = serverId; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java index 11ec0ca..ce1a715 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetPmDataReq.java @@ -17,45 +17,44 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; public class GetPmDataReq { - + private String nodeIdBad; private String nodeIdPoor; - + public GetPmDataReq() { super(); } - + /** * Constructor with all fields. - * - * @param nodeIdBad - * Cells with bad PM value. - * @param nodeIdPoor - * Cells with poor PM value. + * + * @param nodeIdBad Cells with bad PM value. + * @param nodeIdPoor Cells with poor PM value. */ public GetPmDataReq(String nodeIdBad, String nodeIdPoor) { super(); this.nodeIdBad = nodeIdBad; this.nodeIdPoor = nodeIdPoor; } - + public String getNodeIdBad() { return nodeIdBad; } - + public void setNodeIdBad(String nodeIdBad) { this.nodeIdBad = nodeIdBad; } - + public String getNodeIdPoor() { return nodeIdPoor; } - + public void setNodeIdPoor(String nodeIdPoor) { this.nodeIdPoor = nodeIdPoor; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java index 1769a0c..f193d5a 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GetTopology.java @@ -20,29 +20,23 @@ package org.onap.ransim.rest.api.models; public class GetTopology { - + private CellDetails currentCell; private int gridX; private int gridY; private String nodeId; private long physicalCellId; - + /** * A constructor GetTopology. * - * @param currentCell - * current cell details - * @param gridX - * x coordinate value for the cell - * @param gridY - * y coordinate value for the cell - * @param nodeId - * node id of the cell - * @param physicalCellId - * pci value for the cell + * @param currentCell current cell details + * @param gridX x coordinate value for the cell + * @param gridY y coordinate value for the cell + * @param nodeId node id of the cell + * @param physicalCellId pci value for the cell */ - public GetTopology(CellDetails currentCell, int gridX, int gridY, - String nodeId, long physicalCellId) { + public GetTopology(CellDetails currentCell, int gridX, int gridY, String nodeId, long physicalCellId) { super(); this.currentCell = currentCell; this.gridX = gridX; @@ -50,49 +44,49 @@ public class GetTopology { this.nodeId = nodeId; this.physicalCellId = physicalCellId; } - + public GetTopology() { - + } - + public CellDetails getCurrentCell() { return currentCell; } - + public void setCurrentCell(CellDetails currentCell) { this.currentCell = currentCell; } - + public int getGridX() { return gridX; } - + public void setGridX(int gridX) { this.gridX = gridX; } - + public int getGridY() { return gridY; } - + public void setGridY(int gridY) { this.gridY = gridY; } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public long getPhysicalCellId() { return physicalCellId; } - + public void setPhysicalCellId(long physicalCellId) { this.physicalCellId = physicalCellId; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java index 5e9dbc5..ff715e3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/ModifyACellReq.java @@ -21,56 +21,53 @@ package org.onap.ransim.rest.api.models; public class ModifyACellReq { - + private String nodeId; private Long newPhysicalCellId; private String newNbrs; - + /** * A constructor for ModifyACellReq. * - * @param nodeId - * node Id of the cell which is to be modified - * @param newPhysicalCellId - * new PCI number for the cell - * @param newNbrs - * new neighbor list for the cell + * @param nodeId node Id of the cell which is to be modified + * @param newPhysicalCellId new PCI number for the cell + * @param newNbrs new neighbor list for the cell */ public ModifyACellReq(String nodeId, Long newPhysicalCellId, String newNbrs) { super(); this.nodeId = nodeId; this.newPhysicalCellId = newPhysicalCellId; this.newNbrs = newNbrs; - + } - + public ModifyACellReq() { - + // Default constructor for ModifyCell } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public Long getNewPhysicalCellId() { return newPhysicalCellId; } - + public void setNewPhysicalCellId(Long newPhysicalCellId) { this.newPhysicalCellId = newPhysicalCellId; } - + public String getNewNbrs() { return newNbrs; } - + public void setNewNbrs(String newNbrs) { this.newNbrs = newNbrs; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java new file mode 100644 index 0000000..2d49f63 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellCU.java @@ -0,0 +1,86 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "NRCELLCU") +public class NRCellCU implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "CELLLOCALID") + private Integer cellLocalId; + @Column(name = "RESOURCETYPE") + private String resourceType; + @ElementCollection(fetch = FetchType.EAGER) + @CollectionTable(name = "PLMNINFO", joinColumns = @JoinColumn(name = "nrcellcu_celllocalid")) + private List<PLMNInfo> pLMNInfoList; + @ManyToOne + @JoinColumn(name = "gnbcuname") + private GNBCUCPFunction gNBCUCPFunction; + + public Integer getCellLocalId() { + return cellLocalId; + } + + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + + public List<PLMNInfo> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfo> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + public GNBCUCPFunction getgNBCUCPFunction() { + return gNBCUCPFunction; + } + + public void setgNBCUCPFunction(GNBCUCPFunction gNBCUCPFunction) { + this.gNBCUCPFunction = gNBCUCPFunction; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java new file mode 100644 index 0000000..4bd9f1c --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NRCellDU.java @@ -0,0 +1,145 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "NRCELLDU") +public class NRCellDU implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "CELLLOCALID") + private Integer cellLocalId; + @Column(name = "OPERATIONALSTATE") + private String operationalState; + @Column(name = "ADMINISTRATIVESTATE") + private String administrativeState; + @Column(name = "CELLSTATE") + private String cellState; + @ElementCollection(fetch = FetchType.EAGER) + @CollectionTable(name = "PLMNINFO", joinColumns = @JoinColumn(name = "nrcelldu_celllocalid")) + private List<PLMNInfo> pLMNInfoList; + @Column(name = "NRPCI") + private Integer nRPCI; + @Column(name = "nRTAC") + private Integer nRTAC; + @Column(name = "RESOURCETYPE") + private String resourceType; + @ManyToOne + @JoinColumn(name = "gnbduid") + private GNBDUFunction gNBDUFunction; + @Column(name = "prb") + private Integer prbs; + + public Integer getCellLocalId() { + return cellLocalId; + } + + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + + public List<PLMNInfo> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfo> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + public String getOperationalState() { + return operationalState; + } + + public void setOperationalState(String operationalState) { + this.operationalState = operationalState; + } + + public String getAdministrativeState() { + return administrativeState; + } + + public void setAdministrativeState(String administrativeState) { + this.administrativeState = administrativeState; + } + + public String getCellState() { + return cellState; + } + + public void setCellState(String cellState) { + this.cellState = cellState; + } + + public Integer getnRPCI() { + return nRPCI; + } + + public void setnRPCI(Integer nRPCI) { + this.nRPCI = nRPCI; + } + + public Integer getnRTAC() { + return nRTAC; + } + + public void setnRTAC(Integer nRTAC) { + this.nRTAC = nRTAC; + } + + public GNBDUFunction getgNBDUFunction() { + return gNBDUFunction; + } + + public void setgNBDUFunction(GNBDUFunction gNBDUFunction) { + this.gNBDUFunction = gNBDUFunction; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public Integer getPrbs() { + return prbs; + } + + public void setPrbs(Integer prbs) { + this.prbs = prbs; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NSSAIConfig.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NSSAIConfig.java new file mode 100644 index 0000000..db7c4e0 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NSSAIConfig.java @@ -0,0 +1,74 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.Table; + +@Table(name = "NSSAICONFIG") +@Embeddable +public class NSSAIConfig implements Serializable { + private static final long serialVersionUID = 1L; + @Column(name = "DLTHPTPERSLICE") + private Integer dLThptPerSlice; + @Column(name = "ULTHPTPERSLICE") + private Integer uLThptPerSlice; + @Column(name = "MAXNUMBEROFCONNS") + private Integer maxNumberOfConns; + @Column(name = "LASTUPDATEDTS") + private Timestamp lastUpdatedTS; + + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + + public Integer getMaxNumberOfConns() { + return maxNumberOfConns; + } + + public void setMaxNumberOfConns(Integer maxNumberOfConns) { + this.maxNumberOfConns = maxNumberOfConns; + } + + public Timestamp getLastUpdatedTS() { + return lastUpdatedTS; + } + + public void setLastUpdatedTS(Timestamp lastUpdatedTS) { + this.lastUpdatedTS = lastUpdatedTS; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java index 8e2ffb9..23fe8ef 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NbrDump.java @@ -17,38 +17,39 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; public class NbrDump { - + private String nodeId; private String blacklisted; - + public NbrDump() { super(); // TODO Auto-generated constructor stub } - + public NbrDump(String nodeId, String blacklisted) { super(); this.nodeId = nodeId; this.blacklisted = blacklisted; } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public String getBlacklisted() { return blacklisted; } - + public void setBlacklisted(String blacklisted) { this.blacklisted = blacklisted; } - + } 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 new file mode 100644 index 0000000..5a716e9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java @@ -0,0 +1,135 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "NEARRTRIC") +public class NearRTRIC implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "NEARRTRICID") + private Integer nearRTRICId; + @Column(name = "GNBID") + private Integer gNBId; + @ElementCollection(targetClass = String.class) + @CollectionTable(name = "TRACKINGAREA", joinColumns = @JoinColumn(name = "nearrtricid")) + private List<String> trackingArea; + @Column(name = "RESOURCETYPE") + private String resourceType; + @OneToMany(mappedBy = "nearRTRIC", cascade = CascadeType.ALL) + private List<GNBCUCPFunction> gNBCUCPList; + @OneToMany(mappedBy = "nearRTRIC", cascade = CascadeType.ALL) + private List<GNBCUUPFunction> gNBCUUPList; + @OneToMany(mappedBy = "nearRTRIC", cascade = CascadeType.ALL) + private List<GNBDUFunction> gNBDUList; + @ElementCollection(targetClass = String.class) + @CollectionTable(name = "RANNFNSSI", joinColumns = @JoinColumn(name = "nearrtricid")) + private List<String> ranNFNSSIList; + @ElementCollection + @CollectionTable(name = "PLMNINFO", joinColumns = @JoinColumn(name = "nearrtricid")) + private List<PLMNInfo> pLMNInfoList; + + public Integer getNearRTRICId() { + return nearRTRICId; + } + + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public List<String> getTrackingArea() { + return trackingArea; + } + + public void setTrackingArea(List<String> trackingArea) { + this.trackingArea = trackingArea; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public List<GNBCUCPFunction> getgNBCUCPList() { + return gNBCUCPList; + } + + public void setgNBCUCPList(List<GNBCUCPFunction> gNBCUCPList) { + this.gNBCUCPList = gNBCUCPList; + } + + public List<GNBCUUPFunction> getgNBCUUPList() { + return gNBCUUPList; + } + + public void setgNBCUUPList(List<GNBCUUPFunction> gNBCUUPList) { + this.gNBCUUPList = gNBCUUPList; + } + + public List<GNBDUFunction> getgNBDUList() { + return gNBDUList; + } + + public void setgNBDUList(List<GNBDUFunction> gNBDUList) { + this.gNBDUList = gNBDUList; + } + + public List<PLMNInfo> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfo> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + public List<String> getRanNFNSSIList() { + return ranNFNSSIList; + } + + public void setRanNFNSSIList(List<String> ranNFNSSIList) { + this.ranNFNSSIList = ranNFNSSIList; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java index 92a03f1..28764e9 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborDetails.java @@ -17,25 +17,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; -import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; -import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "NeighborDetails") public class NeighborDetails { - + @EmbeddedId private NeihborId neigbor; - + private boolean blacklisted; - + public NeighborDetails() { - + } public NeighborDetails(NeihborId neigbor, boolean blacklisted) { @@ -44,7 +43,6 @@ public class NeighborDetails { this.blacklisted = blacklisted; } - public NeihborId getNeigbor() { return neigbor; } @@ -60,6 +58,5 @@ public class NeighborDetails { public void setBlacklisted(boolean blacklisted) { this.blacklisted = blacklisted; } - - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java index a5614f1..c2f9384 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeighborPmDetails.java @@ -17,48 +17,49 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; public class NeighborPmDetails { - + private String nbrCellId; private String kpiName; private int kpiValue; - + public NeighborPmDetails(String nbrCellId, String kpiName, int kpiValue) { super(); this.nbrCellId = nbrCellId; this.kpiName = kpiName; this.kpiValue = kpiValue; } - + public NeighborPmDetails() { super(); // TODO Auto-generated constructor stub } - + public String getNbrCellId() { return nbrCellId; } - + public void setNbrCellId(String nbrCellId) { this.nbrCellId = nbrCellId; } - + public String getKpiName() { return kpiName; } - + public void setKpiName(String kpiName) { this.kpiName = kpiName; } - + public int getKpiValue() { return kpiValue; } - + public void setKpiValue(int kpiValue) { this.kpiValue = kpiValue; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java index 13bf9b7..92b8771 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NeihborId.java @@ -17,52 +17,50 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Embeddable; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; @Embeddable public class NeihborId implements Serializable { - + + private static final long serialVersionUID = 1L; + @Column(name = "sourceCellNodeId") private String sourceCellNodeId; - + @Column(name = "neighborCellNodeId") private String neighborCell; - + public NeihborId() { } - + public NeihborId(String sourceCellNodeId, String neighborCell) { this.sourceCellNodeId = sourceCellNodeId; this.neighborCell = neighborCell; } - + public String getSourceCellNodeId() { return sourceCellNodeId; } - + public String getNeighborCell() { return neighborCell; } - + @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result - + ((neighborCell == null) ? 0 : neighborCell.hashCode()); - result = prime - * result - + ((sourceCellNodeId == null) ? 0 : sourceCellNodeId.hashCode()); + result = prime * result + ((neighborCell == null) ? 0 : neighborCell.hashCode()); + result = prime * result + ((sourceCellNodeId == null) ? 0 : sourceCellNodeId.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) { @@ -90,4 +88,4 @@ public class NeihborId implements Serializable { } return true; } -}
\ No newline at end of file +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java index bf91f7b..a33f616 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NetconfServers.java @@ -25,6 +25,7 @@ import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -32,73 +33,67 @@ import javax.persistence.Table; @Entity @Table(name = "NetconfServers") public class NetconfServers { - + @Id @Column(name = "serverId", unique = true, nullable = false, length = 20) private String serverId; - + private String ip; private String netconfPort; - - @OneToMany(targetEntity = CellDetails.class, orphanRemoval = true, cascade = { CascadeType.ALL }) - // @OneToMany(targetEntity = CellDetails.class) + + @OneToMany(targetEntity = CellDetails.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Set<CellDetails> cells; - + public NetconfServers() { - + } - + /** * A constructor for Netconf server table class. * - * @param serverId - * server Id of the netconf server - * @param ip - * ip address of the netconf server - * @param netconfPort - * port number of the netconf server - * @param cells - * List of cells belonging to the netconf server + * @param serverId server Id of the netconf server + * @param ip ip address of the netconf server + * @param netconfPort port number of the netconf server + * @param cells List of cells belonging to the netconf server */ - public NetconfServers(String serverId, String ip, String netconfPort, - Set<CellDetails> cells) { + public NetconfServers(String serverId, String ip, String netconfPort, Set<CellDetails> cells) { super(); this.serverId = serverId; this.ip = ip; this.netconfPort = netconfPort; this.cells = cells; } - + public String getServerId() { return serverId; } - + public void setServerId(String serverId) { this.serverId = serverId; } - + public String getIp() { return ip; } - + public void setIp(String ip) { this.ip = ip; } - + public String getNetconfPort() { return netconfPort; } - + public void setNetconfPort(String netconfPort) { this.netconfPort = netconfPort; } - + public Set<CellDetails> getCells() { return cells; } - + public void setCells(Set<CellDetails> cells) { this.cells = cells; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java index cfc55ce..86a83de 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/OperationLog.java @@ -20,89 +20,83 @@ package org.onap.ransim.rest.api.models; +import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.Table; -import javax.persistence.Id; import javax.persistence.GeneratedValue; -import javax.persistence.Column; import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; @Entity @Table(name = "OperationLog") public class OperationLog { - + @Id @GeneratedValue(strategy = GenerationType.AUTO) private int rowId; private long time; private String nodeId; private String source; - + @Column(name = "message", length = 300) private String message; private String fieldName; private String operation; - /*private String prevValue; - - @Column(name = "currValue", length = 500) - private String currValue;*/ - + public int getRowId() { return rowId; } - + public void setRowId(int rowId) { this.rowId = rowId; } - + public long getTime() { return time; } - - + public String getSource() { - return source; - } + return source; + } - public void setSource(String source) { - this.source = source; - } + public void setSource(String source) { + this.source = source; + } - public void setTime(long time) { + public void setTime(long time) { this.time = time; } - + public String getNodeId() { return nodeId; } - + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public String getMessage() { return message; } - + public void setMessage(String message) { this.message = message; } - + public String getFieldName() { return fieldName; } - + public void setFieldName(String fieldName) { this.fieldName = fieldName; } - + public String getOperation() { return operation; } - + public void setOperation(String operation) { this.operation = operation; } - - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfo.java new file mode 100644 index 0000000..a7121bd --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfo.java @@ -0,0 +1,63 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Embeddable +@Table(name = "PLMNINFO") +public class PLMNInfo implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name = "PLMNID") + private String pLMNId; + + @Embedded + private SNSSAI sNSSAI; + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public SNSSAI getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(SNSSAI sNSSAI) { + this.sNSSAI = sNSSAI; + } + +} 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 new file mode 100644 index 0000000..fd674bc --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java @@ -0,0 +1,113 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +public class PLMNInfoModel { + private String pLMNId; + private String snssai; + private String status; + private String gnbType; + private int gnbId; + private int nrCellId; + private String nearrtricid; + private long maxNumberOfConns; + + public PLMNInfoModel() { + + } + + public PLMNInfoModel(String pLMNId, String snssai, String status, String gnbType, int gnbId, int nrCellId, + String nearrtricid, long maxNumberOfConns) { + super(); + this.pLMNId = pLMNId; + this.snssai = snssai; + this.status = status; + this.gnbType = gnbType; + this.gnbId = gnbId; + this.nrCellId = nrCellId; + this.nearrtricid = nearrtricid; + this.maxNumberOfConns = maxNumberOfConns; + } + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public String getSnssai() { + return snssai; + } + + public void setSnssai(String snssai) { + this.snssai = snssai; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getGnbType() { + return gnbType; + } + + public void setGnbType(String gnbType) { + this.gnbType = gnbType; + } + + public int getGnbId() { + return gnbId; + } + + public void setGnbId(int gnbId) { + this.gnbId = gnbId; + } + + public int getNrCellId() { + return nrCellId; + } + + public void setNrCellId(int nrCellId) { + this.nrCellId = nrCellId; + } + + public String getNearrtricid() { + return nearrtricid; + } + + public void setNearrtricid(String nearrtricid) { + this.nearrtricid = nearrtricid; + } + + public long getMaxNumberOfConns() { + return maxNumberOfConns; + } + + public void setMaxNumberOfConns(long maxNumberOfConns) { + this.maxNumberOfConns = maxNumberOfConns; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java index 745b475..6b273ae 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmDataDump.java @@ -23,25 +23,25 @@ package org.onap.ransim.rest.api.models; import java.util.List; public class PmDataDump { - + private List<PmParameters> kpiDump; - + public PmDataDump() { super(); // TODO Auto-generated constructor stub } - + public PmDataDump(List<PmParameters> kpiDump) { super(); this.kpiDump = kpiDump; } - + public List<PmParameters> getKpiDump() { return kpiDump; } - + public void setKpiDump(List<PmParameters> kpiDump) { this.kpiDump = kpiDump; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java index fc48e02..3e368d4 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PmParameters.java @@ -21,7 +21,7 @@ package org.onap.ransim.rest.api.models; public class PmParameters { - + private String parameter1; private String successValue1; private String badValue1; @@ -30,56 +30,69 @@ public class PmParameters { private String successValue2; private String badValue2; private String poorValue2; - + public String getParameter1() { return parameter1; } + public void setParameter1(String parameter1) { this.parameter1 = parameter1; } + public String getSuccessValue1() { return successValue1; } + public void setSuccessValue1(String successValue1) { this.successValue1 = successValue1; } + public String getBadValue1() { return badValue1; } + public void setBadValue1(String badValue1) { this.badValue1 = badValue1; } + public String getPoorValue1() { return poorValue1; } + public void setPoorValue1(String poorValue1) { this.poorValue1 = poorValue1; } + public String getParameter2() { return parameter2; } + public void setParameter2(String parameter2) { this.parameter2 = parameter2; } + public String getSuccessValue2() { return successValue2; } + public void setSuccessValue2(String successValue2) { this.successValue2 = successValue2; } + public String getBadValue2() { return badValue2; } + public void setBadValue2(String badValue2) { this.badValue2 = badValue2; } + public String getPoorValue2() { return poorValue2; } + public void setPoorValue2(String poorValue2) { this.poorValue2 = poorValue2; } - - - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RANSliceInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RANSliceInfo.java new file mode 100644 index 0000000..b42cd51 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RANSliceInfo.java @@ -0,0 +1,141 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity(name = "RANINVENTORY") +@Table(name = "RANINVENTORY") +public class RANSliceInfo implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "RANNFNSSIID") + private String ranNFNSSIId; + @ElementCollection + @CollectionTable(name = "rannssi", joinColumns = @JoinColumn(name = "rannfnssiid")) + private List<String> ranNSSIList; + @ElementCollection + @CollectionTable(name = "nssai", joinColumns = @JoinColumn(name = "rannfnssiid")) + private List<String> nSSAIList; + @OneToMany(mappedBy = "rANSliceInventory", cascade = CascadeType.ALL) + private List<SliceProfile> sliceProfilesList; + @Column(name = "TALIST") + private String trackingAreaList; + @Column(name = "SUBNETSTATUS") + private String subnetStatus; + @Column(name = "NSSTID") + private String nsstId; + @Column(name = "SLICETYPE") + private String sliceType; + @Column(name = "ISSHAREABLE") + private String isShareable; + + public String getRanNFNSSIId() { + return ranNFNSSIId; + } + + public void setRanNFNSSIId(String ranNFNSSIId) { + this.ranNFNSSIId = ranNFNSSIId; + } + + public List<String> getRanNSSIList() { + return ranNSSIList; + } + + public void setRanNSSIList(List<String> ranNSSIList) { + this.ranNSSIList = ranNSSIList; + } + + public List<SliceProfile> getSliceProfilesList() { + return sliceProfilesList; + } + + public void setSliceProfilesList(List<SliceProfile> sliceProfilesList) { + this.sliceProfilesList = sliceProfilesList; + } + + public String getSubnetStatus() { + return subnetStatus; + } + + public void setSubnetStatus(String subnetStatus) { + this.subnetStatus = subnetStatus; + } + + public String getNsstId() { + return nsstId; + } + + public void setNsstId(String nsstId) { + this.nsstId = nsstId; + } + + public String getSliceType() { + return sliceType; + } + + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + + public String getIsShareable() { + return isShareable; + } + + public void setIsShareable(String isShareable) { + this.isShareable = isShareable; + } + + public List<String> getnSSAIList() { + return nSSAIList; + } + + public void setnSSAIList(List<String> nSSAIList) { + this.nSSAIList = nSSAIList; + } + + public String getTrackingAreaList() { + return trackingAreaList; + } + + public void setTrackingAreaList(String trackingAreaList) { + this.trackingAreaList = trackingAreaList; + } + + @Override + public String toString() { + return "RANSliceInfo [ranNFNSSIId=" + ranNFNSSIId + ", ranNSSIList=" + ranNSSIList + ", nSSAIList=" + nSSAIList + + ", sliceProfilesList=" + sliceProfilesList + ", trackingAreaList=" + trackingAreaList + + ", subnetStatus=" + subnetStatus + ", nsstId=" + nsstId + ", sliceType=" + sliceType + + ", isShareable=" + isShareable + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyMember.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyMember.java new file mode 100644 index 0000000..7e8d1bb --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyMember.java @@ -0,0 +1,66 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "RRMPOLICYMEMBER") +public class RRMPolicyMember implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "PLMNID") + private String pLMNId; + @Column(name = "SNSSAI") + private String sNSSAI; + @ManyToOne + private RRMPolicyRatio rrmPolicy; + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public String getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + + public RRMPolicyRatio getRrmPolicy() { + return rrmPolicy; + } + + public void setRrmPolicy(RRMPolicyRatio rrmPolicy) { + this.rrmPolicy = rrmPolicy; + } +} 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 new file mode 100644 index 0000000..33546c3 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java @@ -0,0 +1,130 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "RRMPOLICYRATIO") +public class RRMPolicyRatio implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "RRMPOLICYID") + private Integer rrmPolicyID; + @Column(name = "RESOURCEID") + private String resourceID; + @Column(name = "RESOURCETYPE") + private String resourceType; + @Column(name = "SLICETYPE") + private String sliceType; + // @OneToMany(mappedBy = "rrmPolicy", cascade={CascadeType.PERSIST,CascadeType.REMOVE}) + @OneToMany(mappedBy = "rrmPolicy", cascade = CascadeType.ALL) + private List<RRMPolicyMember> rRMPolicyMemberList; + @Column(name = "QUOTATYPE") + private String quotaType; + @Column(name = "RRMPOLICYMAXRATIO") + private Integer rRMPolicyMaxRatio; + @Column(name = "RRMPOLICYMINRATIO") + private Integer rRMPolicyMinRatio; + @Column(name = "RRMPOLICYDEDICATEDRATIO") + private Integer rRMPolicyDedicatedRatio; + + public Integer getRrmPolicyID() { + return rrmPolicyID; + } + + public void setRrmPolicyID(Integer rrmPolicyID) { + this.rrmPolicyID = rrmPolicyID; + } + + public String getResourceID() { + return resourceID; + } + + public void setResourceID(String resourceID) { + this.resourceID = resourceID; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public String getSliceType() { + return sliceType; + } + + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + + public List<RRMPolicyMember> getrRMPolicyMemberList() { + return rRMPolicyMemberList; + } + + public void setrRMPolicyMemberList(List<RRMPolicyMember> rRMPolicyMemberList) { + this.rRMPolicyMemberList = rRMPolicyMemberList; + } + + public String getQuotaType() { + return quotaType; + } + + public void setQuotaType(String quotaType) { + this.quotaType = quotaType; + } + + public Integer getrRMPolicyMaxRatio() { + return rRMPolicyMaxRatio; + } + + public void setrRMPolicyMaxRatio(Integer rRMPolicyMaxRatio) { + this.rRMPolicyMaxRatio = rRMPolicyMaxRatio; + } + + public Integer getrRMPolicyMinRatio() { + return rRMPolicyMinRatio; + } + + public void setrRMPolicyMinRatio(Integer rRMPolicyMinRatio) { + this.rRMPolicyMinRatio = rRMPolicyMinRatio; + } + + public Integer getrRMPolicyDedicatedRatio() { + return rRMPolicyDedicatedRatio; + } + + public void setrRMPolicyDedicatedRatio(Integer rRMPolicyDedicatedRatio) { + this.rRMPolicyDedicatedRatio = rRMPolicyDedicatedRatio; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SNSSAI.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SNSSAI.java new file mode 100644 index 0000000..e33a871 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SNSSAI.java @@ -0,0 +1,89 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.Embedded; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Embeddable +@Table(name = "SNSSAI") +public class SNSSAI implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name = "sNSSAI") + private String sNSSAI; + @Column(name = "STATUS") + private String status; + @Column(name = "GLOBALSUBSCRIBERID") + private String globalSubscriberId; + @Column(name = "SUBSCRIPTIONSERVICETYPE") + private String subscriptionServiceType; + @Embedded + private NSSAIConfig configData; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public NSSAIConfig getConfigData() { + return configData; + } + + public void setConfigData(NSSAIConfig configData) { + this.configData = configData; + } + + public String getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java index 2d51c83..e3f95d6 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetCollisionReq.java @@ -27,8 +27,7 @@ public class SetCollisionReq { /** * A constructor for SetCollisionReq. * - * @param collision - * to set if the new simulation has collision between the cells + * @param collision to set if the new simulation has collision between the cells */ public SetCollisionReq(boolean collision) { super(); diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java index 1d6d9d5..6116a8e 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SetConstants.java @@ -37,18 +37,14 @@ public class SetConstants { /** * A constructor for SetConstants. * - * @param gridSize - * grid dimension for the topology (number of cells along the side) - * @param gridType - * honeycomb or square grid - * @param collision - * to set if the new simulation has collision between the cells - * @param processCapacity - * number of netconf servers - * @param numberOfMachines - * number of machines running in one netconf server - * @param serverIdPrefix - * server id prefix + * @param gridSize grid dimension for the topology (number of cells + * along the side) + * @param gridType honeycomb or square grid + * @param collision to set if the new simulation has collision between + * the cells + * @param processCapacity number of netconf servers + * @param numberOfMachines number of machines running in one netconf server + * @param serverIdPrefix server id prefix */ public SetConstants(int gridSize, int gridType, boolean collision, int processCapacity, int numberOfMachines, String serverIdPrefix) { diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SliceProfile.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SliceProfile.java new file mode 100644 index 0000000..c65a22e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/SliceProfile.java @@ -0,0 +1,175 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "SLICEPROFILE") +public class SliceProfile implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "SLICEPROFILEID") + private String sliceProfileId; + @Column(name = "SNSSAI") + private String sNSSAI; + @Column(name = "PLMNIDLIST") + private String pLMNIdList; + @Column(name = "MAXNOOFUES") + private Integer maxNumberofUEs; + @Column(name = "LATENCY") + private Integer latency; + @Column(name = "DLTHPTPERSLICE") + private Integer dLThptPerSlice; + @Column(name = "ULTHPTPERSLICE") + private Integer uLThptPerSlice; + @Column(name = "MAXNUMBEROFCONNS") + private Integer maxNumberofConns; + + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + + public Integer getMaxNumberofConns() { + return maxNumberofConns; + } + + public void setMaxNumberofConns(Integer maxNumberofConns) { + this.maxNumberofConns = maxNumberofConns; + } + + public String getCoverageAreaList() { + return coverageAreaList; + } + + /* + * @Column(name="EXPDATARATEDL") private Integer expDataRateDL; + * + * @Column(name="EXPDATARATEUL") private Integer expDataRateUL; + * + * @Column(name="MAXNUMBEROFPDUSESSIONS") private Integer + * maxNumberofPDUSessions; + */ + @Column(name = "UEMOBILITYLEVEL") + private String uEMobilityLevel; + @Column(name = "RESOURCESHARINGLEVEL") + private String resourceSharingLevel; + // @ElementCollection + // @CollectionTable(name="coveragearealist", joinColumns = + // @JoinColumn(name="sliceprofileid")) + @Column(name = "coveragearealist") + private String coverageAreaList; + @ManyToOne + @JoinColumn(name = "rannfnssiid") + private RANSliceInfo rANSliceInventory; + + public String getSliceProfileId() { + return sliceProfileId; + } + + public void setSliceProfileId(String sliceProfileId) { + this.sliceProfileId = sliceProfileId; + } + + public String getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + + public String getpLMNIdList() { + return pLMNIdList; + } + + public void setpLMNIdList(String pLMNIdList) { + this.pLMNIdList = pLMNIdList; + } + + public Integer getMaxNumberofUEs() { + return maxNumberofUEs; + } + + public void setMaxNumberofUEs(Integer maxNumberofUEs) { + this.maxNumberofUEs = maxNumberofUEs; + } + + public Integer getLatency() { + return latency; + } + + public void setLatency(Integer latency) { + this.latency = latency; + } + + public String getuEMobilityLevel() { + return uEMobilityLevel; + } + + public void setuEMobilityLevel(String uEMobilityLevel) { + this.uEMobilityLevel = uEMobilityLevel; + } + + public String getResourceSharingLevel() { + return resourceSharingLevel; + } + + public void setResourceSharingLevel(String resourceSharingLevel) { + this.resourceSharingLevel = resourceSharingLevel; + } + + public RANSliceInfo getrANSliceInventory() { + return rANSliceInventory; + } + + public void setrANSliceInventory(RANSliceInfo rANSliceInventory) { + this.rANSliceInventory = rANSliceInventory; + } + + public void setCoverageAreaList(String coverageAreaList) { + this.coverageAreaList = coverageAreaList; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TACells.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TACells.java new file mode 100644 index 0000000..40ab024 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TACells.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.models; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "TACELLS") +public class TACells implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "TRACKINGAREA") + private String trackingArea; + @Column(name = "CELLS") + private String cellsList; + + public String getTrackingArea() { + return trackingArea; + } + + public void setTrackingArea(String trackingArea) { + this.trackingArea = trackingArea; + } + + public String getCellsList() { + return cellsList; + } + + public void setCellsList(String cellsList) { + this.cellsList = cellsList; + } + + @Override + public String toString() { + return "TACells [trackingArea=" + trackingArea + ", cellsList=" + cellsList + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java index 87d575e..3547eac 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/Topology.java @@ -33,18 +33,12 @@ public class Topology { /** * A constructor for Topology. * - * @param gridSize - * grid size - * @param minScreenX - * min value of screen X for a cell in the topology - * @param minScreenY - * min value of screen Y for a cell in the topology - * @param maxScreenX - * max value of screen X for a cell in the topology - * @param maxScreenY - * max value of screen Y for a cell in the topology - * @param cellTopology - * list of cells within the topology + * @param gridSize grid size + * @param minScreenX min value of screen X for a cell in the topology + * @param minScreenY min value of screen Y for a cell in the topology + * @param maxScreenX max value of screen X for a cell in the topology + * @param maxScreenY max value of screen Y for a cell in the topology + * @param cellTopology list of cells within the topology */ public Topology(int gridSize, float minScreenX, float minScreenY, float maxScreenX, float maxScreenY, List<CellDetails> cellTopology) { diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java index d7825f9..54e6bcf 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/TopologyDump.java @@ -29,8 +29,7 @@ public class TopologyDump { /** * A constructor for TopologyDump. * - * @param cellList - * list of cells + * @param cellList list of cells */ public TopologyDump(List<CellData> cellList) { diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellDetailsRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellDetailsRepo.java new file mode 100644 index 0000000..da7e8d6 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellDetailsRepo.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import java.util.List; + +import org.onap.ransim.rest.api.models.CellDetails; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CellDetailsRepo extends CrudRepository<CellDetails, String> { + + @Query("SELECT n FROM CellDetails n WHERE n.serverId is null") + List<CellDetails> findCellsWithNoServerId(); + + @Query("SELECT cd from CellDetails cd where cd.pciCollisionDetected=true or cd.pciConfusionDetected=true") + List<CellDetails> getCellsWithCollisionOrConfusion(); +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellNeighborRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellNeighborRepo.java new file mode 100644 index 0000000..87134b2 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/CellNeighborRepo.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.CellNeighbor; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CellNeighborRepo extends CrudRepository<CellNeighbor, String> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUCPRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUCPRepository.java new file mode 100644 index 0000000..d9e028f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUCPRepository.java @@ -0,0 +1,41 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import java.util.List; + +import org.onap.ransim.rest.api.models.GNBCUCPFunction; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface GNBCUCPRepository extends CrudRepository<GNBCUCPFunction, String> { + @Query( + nativeQuery = true, + value = "select distinct(cucp.gnbcuname) from gnbcucpfunction cucp join nrcellcu cellcu where cellcu.celllocalid in (:cellIdList)") + public List<String> findCUCPByCellIds(List<Integer> cellIdList); + + @Query( + nativeQuery = true, + value = "select * from gnbcucpfunction cucp join plmninfo plmn where plmn.snssai=?1 and plmn.nrcellcu_celllocalid IS NOT NULL") + public List<GNBCUCPFunction> findCUCPsByNSSAI(String nSSAI); +} 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 new file mode 100644 index 0000000..8bb2ad2 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java @@ -0,0 +1,30 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.GNBCUUPFunction; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface GNBCUUPRepository extends CrudRepository<GNBCUUPFunction, Integer> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBDURepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBDURepository.java new file mode 100644 index 0000000..29a7a8c --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBDURepository.java @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import java.util.List; + +import org.onap.ransim.rest.api.models.GNBDUFunction; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface GNBDURepository extends CrudRepository<GNBDUFunction, Integer> { + @Query( + nativeQuery = true, + value = "select * from gnbdufunction du join plmninfo plmn where plmn.snssai=?1 and plmn.nrcelldu_celllocalid IS NOT NULL") + public List<GNBDUFunction> findDUsByNSSAI(String nSSAI); +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java new file mode 100644 index 0000000..cbad231 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellCURepository.java @@ -0,0 +1,30 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.NRCellCU; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface NRCellCURepository extends CrudRepository<NRCellCU, Integer> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellDURepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellDURepository.java new file mode 100644 index 0000000..7022c6f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NRCellDURepository.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.NRCellDU; +import org.springframework.data.repository.CrudRepository; + +public interface NRCellDURepository extends CrudRepository<NRCellDU, Integer> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NearRTRICRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NearRTRICRepository.java new file mode 100644 index 0000000..8ed4882 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NearRTRICRepository.java @@ -0,0 +1,47 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import java.util.List; +import java.util.Set; + +import org.onap.ransim.rest.api.models.NearRTRIC; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface NearRTRICRepository extends CrudRepository<NearRTRIC, Integer> { + + @Query(nativeQuery = true, value = "select * from nearrtric ric join trackingarea ta where tracking_area=?1") + public List<NearRTRIC> getListOfRICsInTrackingArea(String trackingArea); + + @Query(nativeQuery = true, value = "select * from nearrtric ric join gnbcucpfunction cucp where cucp.gnbcuname=?1") + public List<NearRTRIC> findNearRTRICByCUCPName(String cucpNames); + + @Query(nativeQuery = true, value = "select * from nearrtric ric join rannfnssi nssi where nssi.rannfnssilist=?1") + public List<NearRTRIC> findNearRTRICByNSSI(String ranNFNSSIId); + + @Query( + nativeQuery = true, + value = "select * from nearrtric ric join plmninfo plmn where plmn.snssai=?1 and plmn.nearrtricid IS NOT NULL") + public Set<NearRTRIC> findNearRTRICByNSSAI(String nSSAI); +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NeighborDetailsRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NeighborDetailsRepo.java new file mode 100644 index 0000000..0493a10 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NeighborDetailsRepo.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.NeighborDetails; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface NeighborDetailsRepo extends CrudRepository<NeighborDetails, String> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NetconfServersRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NetconfServersRepo.java new file mode 100644 index 0000000..2e0ae32 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/NetconfServersRepo.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.NetconfServers; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface NetconfServersRepo extends CrudRepository<NetconfServers, String> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/OperationLogRepo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/OperationLogRepo.java new file mode 100644 index 0000000..8e900f5 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/OperationLogRepo.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.OperationLog; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface OperationLogRepo extends CrudRepository<OperationLog, String> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RANInventoryRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RANInventoryRepository.java new file mode 100644 index 0000000..8972732 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RANInventoryRepository.java @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.RANSliceInfo; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface RANInventoryRepository extends CrudRepository<RANSliceInfo, String> { + @Query( + nativeQuery = true, + value = "select distinct(raninfo.rannfnssiid) from raninventory raninfo join nssai where nssai.nssailist=?1") + public String findRANNFNSSIofNSSAI(String sNSSAI); +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyMemberRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyMemberRepository.java new file mode 100644 index 0000000..d0b0b25 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyMemberRepository.java @@ -0,0 +1,30 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.RRMPolicyMember; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface RRMPolicyMemberRepository extends CrudRepository<RRMPolicyMember, Integer> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyRepository.java new file mode 100644 index 0000000..880381f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/RRMPolicyRepository.java @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.RRMPolicyRatio; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface RRMPolicyRepository extends CrudRepository<RRMPolicyRatio, Integer> { + + @Query(nativeQuery = true, value = "select * from rrmpolicy where resourcetype=?1 and resourceid=?2") + public RRMPolicyRatio findByResourceTypeAndId(String resourceType, String resourceId); + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/SliceProfileRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/SliceProfileRepository.java new file mode 100644 index 0000000..6db7626 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/SliceProfileRepository.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.SliceProfile; +import org.springframework.data.repository.CrudRepository; + +public interface SliceProfileRepository extends CrudRepository<SliceProfile, String> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/TACellRepository.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/TACellRepository.java new file mode 100644 index 0000000..92ccd1a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/TACellRepository.java @@ -0,0 +1,35 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.repository; + +import org.onap.ransim.rest.api.models.TACells; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +/*** + * + * @author onapadmin + * + */ +@Repository +public interface TACellRepository extends CrudRepository<TACells, String> { + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java new file mode 100644 index 0000000..7e2172b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RANSliceConfigService.java @@ -0,0 +1,660 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.services; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.apache.log4j.Logger; +import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; +import org.onap.ransim.rest.api.models.GNBCUCPFunction; +import org.onap.ransim.rest.api.models.GNBCUUPFunction; +import org.onap.ransim.rest.api.models.GNBDUFunction; +import org.onap.ransim.rest.api.models.NRCellCU; +import org.onap.ransim.rest.api.models.NRCellDU; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.api.models.NearRTRIC; +import org.onap.ransim.rest.api.models.PLMNInfo; +import org.onap.ransim.rest.api.models.RANSliceInfo; +import org.onap.ransim.rest.api.models.RRMPolicyRatio; +import org.onap.ransim.rest.api.models.SliceProfile; +import org.onap.ransim.rest.api.models.TACells; +import org.onap.ransim.rest.api.repository.GNBCUCPRepository; +import org.onap.ransim.rest.api.repository.GNBCUUPRepository; +import org.onap.ransim.rest.api.repository.GNBDURepository; +import org.onap.ransim.rest.api.repository.NRCellCURepository; +import org.onap.ransim.rest.api.repository.NearRTRICRepository; +import org.onap.ransim.rest.api.repository.RANInventoryRepository; +import org.onap.ransim.rest.api.repository.RRMPolicyRepository; +import org.onap.ransim.rest.api.repository.TACellRepository; +import org.onap.ransim.rest.web.mapper.GNBCUCPModel; +import org.onap.ransim.rest.web.mapper.GNBCUUPModel; +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.rest.web.mapper.RANSliceInfoModel; +import org.onap.ransim.rest.web.mapper.RRMPolicyRatioModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class RANSliceConfigService { + private static Logger logger = Logger.getLogger(RANSliceConfigService.class.getName()); + @Autowired + private NRCellCURepository nRCellCURepository; + + @Autowired + private GNBCUCPRepository gNBCUCPRepository; + + @Autowired + private GNBCUUPRepository gNBCUUPRepository; + + @Autowired + private GNBDURepository gNBDURepository; + + @Autowired + private NearRTRICRepository nearRTRICRepository; + + @Autowired + private RRMPolicyRepository rRMPolicyRepository; + + @Autowired + private RANInventoryRepository ranInventoryRepo; + + @Autowired + private TACellRepository tACellRepository; + + private ModelMapper modelMapper = new ModelMapper(); + + /** + * To store/update the NRCEllCU details + * + * @param nRCellCUModel + * @return NRCellCUModel + */ + public NRCellCUModel saveNRcellCU(NRCellCUModel nRCellCUModel) { + logger.debug("Request received to save NRcellCU: id::" + nRCellCUModel.getCellLocalId()); + NRCellCU cellCUEntity = new NRCellCU(); + modelMapper.map(nRCellCUModel, cellCUEntity); + if (!cellCUEntity.getpLMNInfoList().isEmpty()) { + for (PLMNInfo plmn : cellCUEntity.getpLMNInfoList()) { + // plmn.setnRCellCU(cellCUEntity); + } + } + NRCellCU cellCUEntityResponse = nRCellCURepository.save(cellCUEntity); + modelMapper.map(cellCUEntityResponse, nRCellCUModel); + return nRCellCUModel; + } + + /** + * To fetch the NRCellCU details + * + * @param cellLocalId + * @return NRCellCUModel + */ + public NRCellCUModel fetchNRCellCUDetails(Integer cellLocalId) { + logger.debug("Request received to fetchNRCellCUDetails: id::" + cellLocalId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + NRCellCU cellCUEntity = + nRCellCURepository.findById(cellLocalId).isPresent() ? nRCellCURepository.findById(cellLocalId).get() + : null; + NRCellCUModel nRCellCUModel = new NRCellCUModel(); + modelMapper.map(cellCUEntity, nRCellCUModel); + return nRCellCUModel; + } + + /** + * To store the slice / config details of GNBCUCPFunction + * + * @param gNBCUCPModel + * @return + */ + public GNBCUCPModel saveGNBCUCP(GNBCUCPModel gNBCUCPModel) { + logger.debug("Request received to save GNBCUCPModel: id::" + gNBCUCPModel.getgNBCUName()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUCPFunction gNBCUCPFunction = new GNBCUCPFunction(); + NearRTRIC nearRTRICRef = new NearRTRIC(); + try { + modelMapper.map(gNBCUCPModel, gNBCUCPFunction); + if (gNBCUCPModel.getNearRTRICId() != null + && nearRTRICRepository.findById(gNBCUCPModel.getNearRTRICId()).isPresent()) { + gNBCUCPFunction.setNearRTRIC(nearRTRICRepository.findById(gNBCUCPModel.getNearRTRICId()).get()); + } + if (gNBCUCPFunction != null && !gNBCUCPFunction.getCellCUList().isEmpty()) { + gNBCUCPFunction.getCellCUList().forEach(cellCU -> { + cellCU.setgNBCUCPFunction(gNBCUCPFunction); + }); + } + GNBCUCPFunction gNBCUCPEntity = gNBCUCPRepository.save(gNBCUCPFunction); + modelMapper.map(gNBCUCPEntity, gNBCUCPModel); + } catch (Exception e) { + logger.debug("Error occured during saveGNBCUCP" + e.getMessage()); + return null; + } + return gNBCUCPModel; + } + + /** + * To fetch the gNBCUCP details + * + * @param cucpName + * @return GNBCUCPModel + */ + public GNBCUCPModel fetchGNBCUCPData(String cucpName) { + logger.debug("Request received to fetch GNBCUCPFunction: name::" + cucpName); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUCPFunction gNBCUCPEntity = + gNBCUCPRepository.findById(cucpName).isPresent() ? gNBCUCPRepository.findById(cucpName).get() : null; + GNBCUCPModel gNBCUCPModel = new GNBCUCPModel(); + modelMapper.map(gNBCUCPEntity, gNBCUCPModel); + return gNBCUCPModel; + } + + /** + * To store the slice / config details of GNBCUCPFunction + * + * @param gNBCUCPModel + * @return + */ + public GNBCUUPModel saveGNBCUUP(GNBCUUPModel gNBCUUPModel) { + logger.debug("Request received to save GNBCUUPModel: id::" + gNBCUUPModel.getgNBCUUPId()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUUPFunction gNBCUUPFunction = new GNBCUUPFunction(); + modelMapper.map(gNBCUUPModel, gNBCUUPFunction); + if (gNBCUUPModel.getNearRTRICId() != null + && nearRTRICRepository.findById(gNBCUUPModel.getNearRTRICId()).isPresent()) { + gNBCUUPFunction.setNearRTRIC(nearRTRICRepository.findById(gNBCUUPModel.getNearRTRICId()).get()); + } + if (gNBCUUPFunction != null && !gNBCUUPFunction.getpLMNInfoList().isEmpty()) { + gNBCUUPFunction.getpLMNInfoList().forEach(plmn -> { + // plmn.setgNBCUUPFunction(gNBCUUPFunction); + }); + } + GNBCUUPFunction gNBCUUPEntity = gNBCUUPRepository.save(gNBCUUPFunction); + modelMapper.map(gNBCUUPEntity, gNBCUUPModel); + return gNBCUUPModel; + } + + /** + * To fetch the gNBCUUP details + * + * @param cucpName + * @return GNBCUUPModel + */ + public GNBCUUPModel fetchGNBCUUPData(Integer gNBCUUPId) { + logger.debug("Request received to fetch GNBCUUPFunction: id::" + gNBCUUPId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBCUUPFunction gNBCUUPEntity = + gNBCUUPRepository.findById(gNBCUUPId).isPresent() ? gNBCUUPRepository.findById(gNBCUUPId).get() : null; + GNBCUUPModel gNBCUUPModel = new GNBCUUPModel(); + modelMapper.map(gNBCUUPEntity, gNBCUUPModel); + return gNBCUUPModel; + } + + /** + * To store the slice / config details of GNBDUFunction + * + * @param GNBDUModel + * @return + */ + public GNBDUModel saveGNBDU(GNBDUModel gNBDUModel) { + logger.debug("Request received to save GNBDUModel: id::" + gNBDUModel.getgNBDUId()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBDUFunction gNBDUFunction = new GNBDUFunction(); + NearRTRIC nearRTRICRef = new NearRTRIC(); + modelMapper.map(gNBDUModel, gNBDUFunction); + if (gNBDUModel.getNearRTRICId() != null + && nearRTRICRepository.findById(gNBDUModel.getNearRTRICId()).isPresent()) { + nearRTRICRef = nearRTRICRepository.findById(gNBDUModel.getNearRTRICId()).get(); + gNBDUFunction.setNearRTRIC(nearRTRICRef); + } + NearRTRIC nearRTRICRefNew = nearRTRICRef; + nearRTRICRefNew.setNearRTRICId(gNBDUModel.getNearRTRICId()); + if (gNBDUFunction != null && !gNBDUFunction.getCellDUList().isEmpty()) { + gNBDUFunction.getCellDUList().forEach(cellDU -> { + cellDU.setgNBDUFunction(gNBDUFunction); + }); + } + GNBDUFunction gNBDUEntity = gNBDURepository.save(gNBDUFunction); + modelMapper.map(gNBDUEntity, gNBDUModel); + return gNBDUModel; + } + + /** + * To fetch the gNBDU details + * + * @param gNBDUId + * @return GNBDUModel + */ + public GNBDUModel fetchGNBDUData(Integer gNBDUId) { + logger.debug("Request received to fetch GNBDUFunction: id::" + gNBDUId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + GNBDUFunction gNBDUEntity = + gNBDURepository.findById(gNBDUId).isPresent() ? gNBDURepository.findById(gNBDUId).get() : null; + GNBDUModel gNBDUModel = new GNBDUModel(); + modelMapper.map(gNBDUEntity, gNBDUModel); + return gNBDUModel; + } + + /** + * Stored NearRTRIC + * + * @param nearRTRIC + * @return + */ + public NearRTRICModel saveNearRTRIC(NearRTRICModel nearRTRIC) { + logger.debug("Request received to store NearRTRIC: id::" + nearRTRIC.getNearRTRICId()); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + NearRTRIC nearRTRICEntity = new NearRTRIC(); + modelMapper.map(nearRTRIC, nearRTRICEntity); + NearRTRIC nearRTRICEntityEResponse = nearRTRICRepository.save(nearRTRICEntity); + modelMapper.map(nearRTRICEntityEResponse, nearRTRIC); + return nearRTRIC; + } + + /** + * To fetch the nearRTRIC details + * + * @param nearRTRICId + * @return NearRTRICModel + */ + public NearRTRICModel fetchNearRTRICData(Integer nearRTRICId) { + logger.debug("Request received to fetch GNBDUFunction: id::" + nearRTRICId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + NearRTRIC nearRTRICEntity = + nearRTRICRepository.findById(nearRTRICId).isPresent() ? nearRTRICRepository.findById(nearRTRICId).get() + : null; + NearRTRICModel nearRTRICModel = new NearRTRICModel(); + modelMapper.map(nearRTRICEntity, nearRTRICModel); + return nearRTRICModel; + } + + /** + * To retrieve the RRMPolicy of a network function + * + * @param resourceType + * @param resourceID + * @return + */ + public RRMPolicyRatioModel fetchRRMPolicyOfNE(String resourceType, String resourceID) { + logger.debug("Request received to fetch RRMPolicy:" + resourceType + "--" + resourceID); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + RRMPolicyRatioModel rrmPolicyResponse = new RRMPolicyRatioModel(); + RRMPolicyRatio rrmPolicyEntity = rRMPolicyRepository.findByResourceTypeAndId(resourceType, resourceID); + modelMapper.map(rrmPolicyEntity, rrmPolicyResponse); + return rrmPolicyResponse; + } + + /** + * To update RRM policy of NF + * + * @param rrmPolicy + * @return + */ + public RRMPolicyRatioModel updateRRMPolicy(RRMPolicyRatioModel rrmPolicy) { + logger.debug("Request received to update RRMPolicy:" + rrmPolicy.getRrmPolicyID()); + RRMPolicyRatio rrmPolicyEntity = new RRMPolicyRatio(); + modelMapper.map(rrmPolicy, rrmPolicyEntity); + rrmPolicyEntity = rRMPolicyRepository.save(rrmPolicyEntity); + modelMapper.map(rrmPolicyEntity, rrmPolicy); + return rrmPolicy; + } + + /** + * @param trackingArea + * @return List<NearRTRICModel> + */ + public List<NearRTRICModel> findRICsInTA(String trackingArea) { + logger.debug("Request received to find the NearRTRICs in Tracking Area::" + trackingArea); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<NearRTRIC> nearRTRICsList = nearRTRICRepository.getListOfRICsInTrackingArea(trackingArea); + List<NearRTRICModel> ricModelList = nearRTRICsList.stream() + .map(ricEntity -> modelMapper.map(ricEntity, NearRTRICModel.class)).collect(Collectors.toList()); + return ricModelList; + } + + /** + * @param cellsList + * @return + */ + public List<NearRTRICModel> findNearRTRICofCells(List<Integer> cellsList) { + List<NearRTRIC> ricEntitiesList = new ArrayList<>(); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<String> cucpNames = gNBCUCPRepository.findCUCPByCellIds(cellsList); + cucpNames.forEach(cucpName -> { + List<NearRTRIC> ricEntities = new ArrayList<>(); + ricEntities = nearRTRICRepository.findNearRTRICByCUCPName(cucpName); + ricEntitiesList.addAll(ricEntities); + }); + List<NearRTRICModel> ricModelList = ricEntitiesList.stream() + .map(ricEntity -> modelMapper.map(ricEntity, NearRTRICModel.class)).collect(Collectors.toList()); + return ricModelList; + } + + /** + * To update the RAN Slice details + * + * @param rANSliceInfoModel + * @return RANSliceInfoModel + */ + public RANSliceInfoModel updateRANInventory(RANSliceInfoModel rANSliceInfoModel) { + logger.debug("Request received to update inventory for id::" + rANSliceInfoModel.getRanNFNSSIId()); + RANSliceInfo rANSliceInfoEntity = new RANSliceInfo(); + modelMapper.map(rANSliceInfoModel, rANSliceInfoEntity); + if (ranInventoryRepo.findById(rANSliceInfoModel.getRanNFNSSIId()).isPresent()) { + RANSliceInfo ranInfo = ranInventoryRepo.findById(rANSliceInfoModel.getRanNFNSSIId()).get(); + List<String> ranNSSIList = ranInfo.getRanNSSIList(); + ranNSSIList.addAll(rANSliceInfoEntity.getRanNSSIList()); + rANSliceInfoEntity.setRanNSSIList(ranNSSIList); + + List<String> nSSAIList = ranInfo.getnSSAIList(); + nSSAIList.addAll(rANSliceInfoEntity.getnSSAIList()); + rANSliceInfoEntity.setnSSAIList(nSSAIList); + + List<SliceProfile> sliceProfilesList = ranInfo.getSliceProfilesList(); + sliceProfilesList.addAll(rANSliceInfoEntity.getSliceProfilesList()); + rANSliceInfoEntity.setSliceProfilesList(sliceProfilesList); + } else { + if (!rANSliceInfoEntity.getSliceProfilesList().isEmpty()) { + for (SliceProfile profile : rANSliceInfoEntity.getSliceProfilesList()) { + profile.setrANSliceInventory(rANSliceInfoEntity); + } + } + } + rANSliceInfoEntity = ranInventoryRepo.save(rANSliceInfoEntity); + modelMapper.map(rANSliceInfoEntity, rANSliceInfoModel); + return rANSliceInfoModel; + } + + /** + * @param ranNFNSSIId + * @return RANSliceInfoModel + */ + public RANSliceInfoModel fetchRANSlice(String ranNFNSSIId) { + logger.debug("Request received to read inventory details for id::" + ranNFNSSIId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + RANSliceInfo ranSliceInfo = + ranInventoryRepo.findById(ranNFNSSIId).isPresent() ? ranInventoryRepo.findById(ranNFNSSIId).get() + : null; + RANSliceInfoModel rANSliceInfoModel = new RANSliceInfoModel(); + modelMapper.map(ranSliceInfo, rANSliceInfoModel); + return rANSliceInfoModel; + } + + /** + * @param trackingArea + * @return List<String> + */ + public List<String> fetchCellsofTA(String trackingArea) { + logger.debug("Request recieved to fetch the cell details of TA:" + trackingArea); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + String cells = tACellRepository.findById(trackingArea).isPresent() + ? tACellRepository.findById(trackingArea).get().getCellsList() + : null; + return cells != null ? Arrays.asList(cells.split(",")) : null; + + } + + public Iterable<TACells> fetchAllTA() { + logger.info("Request recieved to fetch all TA:"); + return tACellRepository.findAll(); + } + + /** + * @param nearRTRICId + * @return List<NRCellCUModel> + */ + public List<NRCellCUModel> fetchCUCellsofRIC(Integer nearRTRICId) { + logger.debug("Request recieved to fetch the cell (CU) details of nearRTRICId:" + nearRTRICId); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<NRCellCU> cellCUEntities = new ArrayList<NRCellCU>(); + NearRTRIC nearRTRIC = + nearRTRICRepository.findById(nearRTRICId).isPresent() ? nearRTRICRepository.findById(nearRTRICId).get() + : null; + if (nearRTRIC != null) { + List<GNBCUCPFunction> cucpFunctions = nearRTRIC.getgNBCUCPList(); + cucpFunctions.forEach(cucpFunction -> { + List<NRCellCU> cellCUList = new ArrayList<NRCellCU>(); + cellCUList.addAll(cucpFunction.getCellCUList()); + cellCUEntities.addAll(cellCUList); + }); + List<NRCellCUModel> cuCellModels = + cellCUEntities.stream().map(cellCUEntity -> modelMapper.map(cellCUEntity, NRCellCUModel.class)) + .collect(Collectors.toList()); + return cuCellModels; + } + return new ArrayList<NRCellCUModel>(); + } + + /** + * @param trackingArea + * @return List<NRCellDUModel> + */ + public Map<Integer, List<NRCellDUModel>> fetchDUCellsofRIC(String sNSSAI) { + logger.debug("Request recieved to fetch the cell (DU) details of sNSSAI:" + sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Set<NRCellDU> cellDUEntities = new HashSet<NRCellDU>(); + Set<NRCellDU> cellDUs = new HashSet<NRCellDU>(); + List<NearRTRICModel> ricModels = findRICsByNSSAI(sNSSAI); + Map<Integer, List<NRCellDUModel>> cellsMap = new HashMap<Integer, List<NRCellDUModel>>(); + List<NearRTRIC> ricEntities = + ricModels.stream().map(ric -> modelMapper.map(ric, NearRTRIC.class)).collect(Collectors.toList()); + ricEntities.forEach(ricEntity -> { + List<GNBDUFunction> duFunctions = ricEntity.getgNBDUList(); + duFunctions.forEach(duFunction -> { + List<NRCellDU> cellDUList = duFunction.getCellDUList(); + cellDUList.forEach(cellDU -> { + List<PLMNInfo> plmnList = cellDU.getpLMNInfoList(); + plmnList.forEach(plmn -> { + if (sNSSAI.equalsIgnoreCase(plmn.getsNSSAI().getsNSSAI())) { + cellDUs.add(cellDU); + } + }); + }); + // cellDUList.addAll(duFunction.getCellDUList()); + cellDUEntities.addAll(cellDUs); + }); + List<NRCellDUModel> duCellModels = + cellDUEntities.stream().map(cellDUEntity -> modelMapper.map(cellDUEntity, NRCellDUModel.class)) + .collect(Collectors.toList()); + cellsMap.put(ricEntity.getNearRTRICId(), duCellModels); + }); + + return cellsMap; + } + + /** + * @param ranNFNSSIID + * @return List<NearRTRICModel> + */ + public List<NearRTRICModel> findNearRTRICByNSSI(String ranNFNSSIID) { + logger.debug("Request recieved to fetch nearRTRIC of NSSI:" + ranNFNSSIID); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<NearRTRIC> nearRTRICEntities = nearRTRICRepository.findNearRTRICByNSSI(ranNFNSSIID); + List<NearRTRICModel> nearRTRICModels = nearRTRICEntities.stream() + .map(nearRTRICEntity -> modelMapper.map(nearRTRICEntity, NearRTRICModel.class)) + .collect(Collectors.toList()); + return nearRTRICModels; + } + + /** + * @param sNSSAI + * @return List<NearRTRICModel> + */ + public List<NearRTRICModel> findRICsByNSSAI(String sNSSAI) { + logger.debug("Request recieved to fetch nearRTRIC of NSSAI:" + sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Set<NearRTRIC> nearRTRICEntities = nearRTRICRepository.findNearRTRICByNSSAI(sNSSAI); + List<NearRTRICModel> nearRTRICModels = nearRTRICEntities.stream() + .map(nearRTRICEntity -> modelMapper.map(nearRTRICEntity, NearRTRICModel.class)) + .collect(Collectors.toList()); + return nearRTRICModels; + } + + /** + * @param sNSSAI + * @return config Details + */ + public Map<String, Integer> findSliceProfileconfig(String sNSSAI) { + logger.debug("Request recieved to fetch Config requested for a slice:" + sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Map<String, Integer> configDetails = new HashMap<String, Integer>(); + String ranNFNSSIId = ranInventoryRepo.findRANNFNSSIofNSSAI(sNSSAI); + RANSliceInfo rANSliceInfo = + ranInventoryRepo.findById(ranNFNSSIId).isPresent() ? ranInventoryRepo.findById(ranNFNSSIId).get() + : null; + if (rANSliceInfo.getSliceProfilesList().size() > 0) { + rANSliceInfo.getSliceProfilesList().forEach(sliceProfile -> { + if (sNSSAI.equalsIgnoreCase(sliceProfile.getsNSSAI())) { + // configDetails.put("maxNoOfConns",sliceProfile.getMaxNumberofConns()); + configDetails.put("dLThptPerSlice", sliceProfile.getdLThptPerSlice()); + configDetails.put("uLThptPerSlice", sliceProfile.getuLThptPerSlice()); + } + }); + } + return configDetails; + } + + /** + * @param sNSSAI + * @return RIC Config for a slice + */ + public Map<Integer, NSSAIConfig> findSliceConfig(String sNSSAI) { + logger.debug("Request recieved to fetch Slice config Details at RICs:" + sNSSAI); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<NearRTRICModel> nearRTRICModels = findRICsByNSSAI(sNSSAI); + Map<Integer, NSSAIConfig> configMap = new HashMap<Integer, NSSAIConfig>(); + nearRTRICModels.forEach(nearRTRIC -> { + nearRTRIC.getpLMNInfoList().forEach(plmn -> { + if (sNSSAI.equalsIgnoreCase(plmn.getsNSSAI().getsNSSAI())) { + configMap.put(nearRTRIC.getNearRTRICId(), plmn.getsNSSAI().getConfigData()); + } + }); + }); + return configMap; + } + + /** + * @param sNSSAI + * @return List<GNBDUModel> + */ + public List<GNBDUModel> findDUsofSNssai(String sNSSAI) { + logger.debug("Request recieved to fetch all DUs of NSSAI"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<GNBDUFunction> duList = (List<GNBDUFunction>) gNBDURepository.findDUsByNSSAI(sNSSAI); + List<GNBDUModel> duModels = duList.stream().map(duEntity -> modelMapper.map(duEntity, GNBDUModel.class)) + .collect(Collectors.toList()); + return duModels; + } + + /** + * @param sNSSAI + * @return List<GNBCUCPModel> + */ + public List<GNBCUCPModel> findCUsofSNssai(String sNSSAI) { + logger.debug("Request recieved to fetch all CUs of NSSAI"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<GNBCUCPFunction> cuList = (List<GNBCUCPFunction>) gNBCUCPRepository.findCUCPsByNSSAI(sNSSAI); + List<GNBCUCPModel> cuModels = cuList.stream().map(cuEntity -> modelMapper.map(cuEntity, GNBCUCPModel.class)) + .collect(Collectors.toList()); + return cuModels; + } + + /** + * @param sNSSAI + * @return Map<String, String> + */ + public Map<String, String> getSubscriberDetails(String sNSSAI) { + logger.debug("Request recieved to fetch SubscriberDetails"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Map<String, String> details = new HashMap<String, String>(); + String ranNFNSSIId = ranInventoryRepo.findRANNFNSSIofNSSAI(sNSSAI); + details.put("ranNFNSSIId", ranNFNSSIId); + details.put("sNSSAI", sNSSAI); + RANSliceInfo rANSliceInfo = + ranInventoryRepo.findById(ranNFNSSIId).isPresent() ? ranInventoryRepo.findById(ranNFNSSIId).get() + : null; + if (rANSliceInfo.getSliceProfilesList().size() > 0) { + rANSliceInfo.getSliceProfilesList().forEach(sliceProfile -> { + if (sNSSAI.equalsIgnoreCase(sliceProfile.getsNSSAI())) { + details.put("sliceProfileId", sliceProfile.getSliceProfileId()); + } + }); + } + List<NearRTRICModel> nearRTRICModels = findRICsByNSSAI(sNSSAI); + nearRTRICModels.forEach(nearRTRIC -> { + nearRTRIC.getpLMNInfoList().forEach(plmn -> { + if (sNSSAI.equalsIgnoreCase(plmn.getsNSSAI().getsNSSAI())) { + details.put("subscriptionServiceType", plmn.getsNSSAI().getSubscriptionServiceType()); + details.put("globalSubscriberId", plmn.getsNSSAI().getGlobalSubscriberId()); + } + }); + }); + + return details; + } + + // Data required for PM data Simulation + /** + * @return List<GNBCUCPModel> + */ + public List<GNBCUCPModel> findAllCUCPFunctions() { + logger.debug("Request recieved to fetch all CUCPs"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<GNBCUCPFunction> cucpsList = (List<GNBCUCPFunction>) gNBCUCPRepository.findAll(); + List<GNBCUCPModel> cucpModels = cucpsList.stream() + .map(cucpEntity -> modelMapper.map(cucpEntity, GNBCUCPModel.class)).collect(Collectors.toList()); + return cucpModels; + } + + /** + * @return List<GNBDUModel> + */ + public List<GNBDUModel> findAllDUFunctions() { + logger.debug("Request recieved to fetch all DUs"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<GNBDUFunction> duList = (List<GNBDUFunction>) gNBDURepository.findAll(); + List<GNBDUModel> duModels = duList.stream().map(duEntity -> { + GNBDUModel gnbDuModel = modelMapper.map(duEntity, GNBDUModel.class); + gnbDuModel.setNearRTRICId(duEntity.getNearRTRIC().getNearRTRICId()); + return gnbDuModel; + }).collect(Collectors.toList()); + return duModels; + } + + public List<NearRTRICModel> findAllNearRTRIC() { + logger.debug("Request received to fetch all NearRTRICModel"); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + List<NearRTRIC> rtricList = (List<NearRTRIC>) nearRTRICRepository.findAll(); + List<NearRTRICModel> rtricmodels = rtricList.stream() + .map(rtricEntity -> modelMapper.map(rtricEntity, NearRTRICModel.class)).collect(Collectors.toList()); + return rtricmodels; + } + +} 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 new file mode 100644 index 0000000..6197751 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java @@ -0,0 +1,1501 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.services; + +import com.google.gson.Gson; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Properties; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import javax.annotation.PostConstruct; +import javax.websocket.Session; + +import org.apache.log4j.Logger; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.onap.ransim.netconf.NetconfClient; +import org.onap.ransim.rest.api.handler.RansimPciHandler; +import org.onap.ransim.rest.api.models.CellData; +import org.onap.ransim.rest.api.models.CellDetails; +import org.onap.ransim.rest.api.models.CellNeighbor; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.api.models.NbrDump; +import org.onap.ransim.rest.api.models.NeighborDetails; +import org.onap.ransim.rest.api.models.NeihborId; +import org.onap.ransim.rest.api.models.NetconfServers; +import org.onap.ransim.rest.api.models.PLMNInfo; +import org.onap.ransim.rest.api.models.RRMPolicyMember; +import org.onap.ransim.rest.api.models.RRMPolicyRatio; +import org.onap.ransim.rest.api.models.SliceProfile; +import org.onap.ransim.rest.api.models.TopologyDump; +import org.onap.ransim.rest.api.repository.GNBCUUPRepository; +import org.onap.ransim.rest.api.repository.NRCellCURepository; +import org.onap.ransim.rest.api.repository.NRCellDURepository; +import org.onap.ransim.rest.api.repository.RRMPolicyRepository; +import org.onap.ransim.rest.api.repository.SliceProfileRepository; +import org.onap.ransim.rest.client.RestClient; +import org.onap.ransim.rest.web.mapper.GNBCUCPModel; +import org.onap.ransim.rest.web.mapper.GNBCUUPModel; +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.NSSAIData; +import org.onap.ransim.rest.web.mapper.NearRTRICModel; +import org.onap.ransim.rest.web.mapper.PLMNInfoModel; +import org.onap.ransim.rest.web.mapper.RRMPolicyRatioModel; +import org.onap.ransim.utilities.RansimUtilities; +import org.onap.ransim.websocket.model.*; +import org.onap.ransim.websocket.model.ConfigData; +import org.onap.ransim.websocket.model.ConfigPLMNInfo; +import org.onap.ransim.websocket.model.ModifyNeighbor; +import org.onap.ransim.websocket.model.ModifyPci; +import org.onap.ransim.websocket.model.Neighbor; +import org.onap.ransim.websocket.model.SNSSAI; +import org.onap.ransim.websocket.model.SetConfigTopology; +import org.onap.ransim.websocket.model.Topology; +import org.onap.ransim.websocket.model.UpdateCell; +import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class RansimControllerServices { + + static Logger log = Logger.getLogger(RansimControllerServices.class.getName()); + + Properties netconfConstants = new Properties(); + public int gridSize = 10; + boolean collision = false; + String serverIdPrefix = ""; + public static String useCaseType = ""; + static int numberOfCellsPerNcServer = 15; + int numberOfMachines = 1; + int numberOfProcessPerMc = 5; + boolean strictValidateRansimAgentsAvailability = false; + static public Map<String, Session> webSocketSessions = new ConcurrentHashMap<String, Session>(); + public static Map<String, String> serverIdIpPortMapping = new ConcurrentHashMap<String, String>(); + + static Map<String, String> globalNcServerUuidMap = new ConcurrentHashMap<String, String>(); + static List<String> unassignedServerIds = Collections.synchronizedList(new ArrayList<String>()); + static Map<String, List<String>> serverIdIpNodeMapping = new ConcurrentHashMap<String, List<String>>(); + static Map<String, List<String>> ricIdFunctionMapping = new ConcurrentHashMap<String, List<String>>(); + static List<String> unassignedgNBIds = Collections.synchronizedList(new ArrayList<String>()); + static List<String> unassignedrtRicIds = Collections.synchronizedList(new ArrayList<String>()); + static List<NearRTRICModel> rtricModelList = Collections.synchronizedList(new ArrayList<>()); + int nextServerIdNumber = 1001; + String sdnrServerIp = ""; + int sdnrServerPort = 0; + static String sdnrServerUserid = ""; + static String sdnrServerPassword = ""; + private static final String fileBasePath = "/tmp/ransim-install/config/"; + public static String dumpFileName = ""; + public static long maxPciValueAllowed = 503; + + @Autowired + RansimPciHandler rsPciHdlr; + + @Autowired + RansimRepositoryService ransimRepo; + + @Autowired + RANSliceConfigService ranSliceConfigService; + + @Autowired + RRMPolicyRepository rrmPolicyRepository; + + @Autowired + NRCellDURepository nRCellDURepository; + + @Autowired + NRCellCURepository nRCellCURepository; + + @Autowired + GNBCUUPRepository gNBCUUPRepository; + /* + * @Autowired + * PLMNInfoRepo pLMNInfoRepo; + * + */ @Autowired + SliceProfileRepository sliceProfileRepository; + + @PostConstruct + private void startWSTheread() { + new KeepWebsockAliveThread(this).start(); + } + + private String checkIpPortAlreadyExists(String ipPort, Map<String, String> serverIdIpPortMapping) { + String serverId = null; + for (String key : serverIdIpPortMapping.keySet()) { + String value = serverIdIpPortMapping.get(key); + if (value.equals(ipPort)) { + serverId = key; + break; + } + } + return serverId; + } + + /** + * Add web socket sessions. + * * @param ipPort ip address for the session + * + * @param wsSession session details + */ + public synchronized String addWebSocketSessions(String ipPort, Session wsSession) { + loadProperties(); + if (webSocketSessions.containsKey(ipPort)) { + log.info("addWebSocketSessions: Client session " + wsSession.getId() + " for " + ipPort + + " already exist. Removing old session."); + webSocketSessions.remove(ipPort); + } + + log.info("addWebSocketSessions: Adding Client session " + wsSession.getId() + " for " + ipPort); + webSocketSessions.put(ipPort, wsSession); + String serverId = null; + if (!serverIdIpPortMapping.containsValue(ipPort)) { + if (unassignedServerIds.size() > 0) { + log.info("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + serverId = checkIpPortAlreadyExists(ipPort, serverIdIpPortMapping); + if (serverId == null) { + serverId = unassignedServerIds.remove(0); + } else { + if (unassignedServerIds.contains(serverId)) { + unassignedServerIds.remove(serverId); + } + } + log.info("RanSim Controller - Available unassigned ServerIds :" + unassignedServerIds); + log.info("RanSim Controller - addWebSocketSessions: Adding serverId " + serverId + " for " + ipPort); + serverIdIpPortMapping.put(serverId, ipPort); + log.debug("RanSim Controller - serverIdIpPortMapping >>>> :" + serverIdIpPortMapping); + mapServerIdToNodes(serverId); + try { + + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server != null) { + server.setIp(ipPort.split(":")[0]); + server.setNetconfPort(ipPort.split(":")[1]); + ransimRepo.mergeNetconfServers(server); + } + + } catch (Exception e1) { + log.error("Exception mapServerIdToNodes :", e1); + } + } else { + log.error("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + } + } else { + for (String key : serverIdIpPortMapping.keySet()) { + if (serverIdIpPortMapping.get(key).equals(ipPort)) { + log.info("addWebSocketSessions: ServerId " + key + " for " + ipPort + " is exist already"); + serverId = key; + break; + } + } + } + return serverId; + } + + public synchronized String addRanWebSocketSessions(String ipPort, Session wsSession) { + if (webSocketSessions.containsKey(ipPort)) { + log.info("addWebSocketSessions: Client session " + wsSession.getId() + " for " + ipPort + + " already exist. Removing old session."); + webSocketSessions.remove(ipPort); + } + + log.info("addWebSocketSessions: Adding Client session " + wsSession.getId() + " for " + ipPort); + webSocketSessions.put(ipPort, wsSession); + String serverId = null; + if (!serverIdIpPortMapping.containsValue(ipPort)) { + if (!ricIdFunctionMapping.isEmpty()) { + if (unassignedgNBIds.size() > 0) { + log.info("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + serverId = checkIpPortAlreadyExists(ipPort, serverIdIpPortMapping); + if (serverId == null) { + serverId = unassignedgNBIds.remove(0); + } else { + if (unassignedgNBIds.contains(serverId)) { + unassignedgNBIds.remove(serverId); + } + } + log.info("RanSim Controller - Available unassigned ServerIds :" + unassignedgNBIds); + log.info( + "RanSim Controller - addWebSocketSessions: Adding serverId " + serverId + " for " + ipPort); + serverIdIpPortMapping.put(serverId, ipPort); + log.debug("RanSim Controller - serverIdIpPortMapping >>>> :" + serverIdIpPortMapping); + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server != null) { + server.setIp(ipPort.split(":")[0]); + server.setNetconfPort(ipPort.split(":")[1]); + ransimRepo.mergeNetconfServers(server); + } + + } catch (Exception e1) { + log.error("Exception mapServerIdToNodes :", e1); + } + } else { + if (unassignedrtRicIds.size() > 0) { + unassignedgNBIds.addAll(ricIdFunctionMapping.get(unassignedrtRicIds.get(0))); + log.info("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + serverId = checkIpPortAlreadyExists(ipPort, serverIdIpPortMapping); + if (serverId == null) { + serverId = unassignedrtRicIds.remove(0); + } else { + if (unassignedrtRicIds.contains(serverId)) { + unassignedrtRicIds.remove(serverId); + } + } + log.info("RanSim Controller - Available unassigned ServerIds :" + unassignedrtRicIds); + log.info("RanSim Controller - addWebSocketSessions: Adding serverId " + serverId + " for " + + ipPort); + serverIdIpPortMapping.put(serverId, ipPort); + log.debug("RanSim Controller - serverIdIpPortMapping >>>> :" + serverIdIpPortMapping); + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server != null) { + server.setIp(ipPort.split(":")[0]); + server.setNetconfPort(ipPort.split(":")[1]); + ransimRepo.mergeNetconfServers(server); + } + + } catch (Exception e1) { + log.error("Exception mapServerIdToNodes :", e1); + } + } else { + log.info("addWebSocketSessions: No ric serverIds pending to assign for " + ipPort); + } + } + } else { + log.error("addWebSocketSessions: No serverIds pending to assign for " + ipPort); + } + } else { + for (String key : serverIdIpPortMapping.keySet()) { + if (serverIdIpPortMapping.get(key).equals(ipPort)) { + log.info("addWebSocketSessions: ServerId " + key + " for " + ipPort + " is exist already"); + serverId = key; + break; + } + } + } + return serverId; + } + + /** + * Map server ID to the cells + * + * @param serverId Server ID + */ + private void mapServerIdToNodes(String serverId) { + dumpSessionDetails(); + // already mapped.RansimController Do nothing. + if (!serverIdIpNodeMapping.containsKey(serverId)) { + List<String> nodeIds = new ArrayList<String>(); + try { + List<CellDetails> nodes = ransimRepo.getCellsWithNoServerIds(); + for (CellDetails cell : nodes) { + cell.setServerId(serverId); + nodeIds.add(cell.getNodeId()); + ransimRepo.mergeCellDetails(cell); + } + serverIdIpNodeMapping.put(serverId, nodeIds); + } catch (Exception e1) { + log.info("Exception mapServerIdToNodes :", e1); + + } + } + } + + /** + * It removes the web socket sessions. + * + * @param ipPort ip address of the netconf server + */ + public synchronized void removeWebSocketSessions(String ipPort) { + log.info("remove websocket session request received for: " + ipPort); + try { + if (webSocketSessions.containsKey(ipPort)) { + String removedServerId = null; + for (String serverId : serverIdIpPortMapping.keySet()) { + String ipPortVal = serverIdIpPortMapping.get(serverId); + if (ipPortVal.equals(ipPort)) { + if (!unassignedServerIds.contains(serverId)) { + unassignedServerIds.add(serverId); + log.info(serverId + "added in unassignedServerIds"); + } + NetconfServers ns = ransimRepo.getNetconfServer(serverId); + ns.setIp(null); + ns.setNetconfPort(null); + log.info(serverId + " ip and Port set as null "); + ransimRepo.mergeNetconfServers(ns); + removedServerId = serverId; + break; + } + } + serverIdIpPortMapping.remove(removedServerId); + + Session wsSession = webSocketSessions.remove(ipPort); + log.info("removeWebSocketSessions: Client session " + wsSession.getId() + " for " + ipPort + + " is removed. Server Id : " + removedServerId); + } else { + log.info("addWebSocketSessions: Client session for " + ipPort + " not exist"); + } + } catch (Exception e) { + log.error("Exception in removeWebSocketSessions. e: " + e); + } + + } + + /** + * Checks the number of ransim agents running. + * + * @param cellsToBeSimulated number of cells to be simulated + * @return returns true if there are enough ransim agents running + */ + public boolean hasEnoughRansimAgentsRunning(int cellsToBeSimulated) { + + log.info("hasEnoughRansimAgentsRunning: numberOfCellsPerNCServer " + numberOfCellsPerNcServer + + " , webSocketSessions.size:" + webSocketSessions.size() + " , cellsToBeSimulated:" + + cellsToBeSimulated); + log.info(strictValidateRansimAgentsAvailability); + + if (strictValidateRansimAgentsAvailability) { + if (numberOfCellsPerNcServer * webSocketSessions.size() < cellsToBeSimulated) { + return false; + } + } + return true; + } + + /** + * It updates the constant values in the properties file. + */ + public void loadProperties() { + InputStream input = null; + try { + + input = new FileInputStream("/tmp/ransim-install/config/ransim.properties"); + netconfConstants.load(input); + serverIdPrefix = netconfConstants.getProperty("serverIdPrefix"); + numberOfCellsPerNcServer = Integer.parseInt(netconfConstants.getProperty("numberOfCellsPerNCServer")); + numberOfMachines = Integer.parseInt(netconfConstants.getProperty("numberOfMachines")); + numberOfProcessPerMc = Integer.parseInt(netconfConstants.getProperty("numberOfProcessPerMc")); + strictValidateRansimAgentsAvailability = + Boolean.parseBoolean(netconfConstants.getProperty("strictValidateRansimAgentsAvailability")); + maxPciValueAllowed = Long.parseLong(netconfConstants.getProperty("maxPciValueAllowed")); + sdnrServerIp = System.getenv("SDNR_IP"); + sdnrServerPort = Integer.parseInt(System.getenv("SDNR_PORT")); + sdnrServerUserid = System.getenv("SDNR_USER"); + sdnrServerPassword = System.getenv("SDNR_PASSWORD"); + useCaseType = "sonUsecase"; + + } catch (Exception e) { + log.error("Properties file error", e); + } finally { + try { + if (input != null) { + input.close(); + } + } catch (Exception ex) { + log.error("Properties file error", ex); + } + } + } + + public void loadGNBFunctionProperties() { + try { + sdnrServerIp = System.getenv("SDNR_IP"); + sdnrServerPort = Integer.parseInt(System.getenv("SDNR_PORT")); + sdnrServerUserid = System.getenv("SDNR_USER"); + sdnrServerPassword = System.getenv("SDNR_PASSWORD"); + useCaseType = "ranSlicingUsecase"; + rtricModelList = ranSliceConfigService.findAllNearRTRIC(); + for (NearRTRICModel rtricModel : rtricModelList) { + List<String> gNBList = new ArrayList<>(); + for (GNBCUCPModel gNBCUCPModel : rtricModel.getgNBCUCPList()) { + gNBList.add(gNBCUCPModel.getgNBCUName()); + setRanNetconfServers(gNBCUCPModel.getgNBCUName()); + for (NRCellCUModel nRCellCUModel : gNBCUCPModel.getCellCUList()) { + if (nRCellCUModel.getpLMNInfoList().isEmpty()) { + org.json.simple.parser.JSONParser jsonParser = new org.json.simple.parser.JSONParser(); + try (FileReader reader = new FileReader("/tmp/ransim-install/config/gNBCUConfig.json")) { + // Read JSON file + Object obj = jsonParser.parse(reader); + JSONArray List = (JSONArray) obj; + for (int i = 0; i < List.size(); i++) { + JSONObject gNB = (JSONObject) List.get(i); + String gNBCUName = (String) gNB.get("gNBCUName"); + Long gNBId = (Long) gNB.get("gNBId"); + Long gNBIdLength = (Long) gNB.get("gNBIdLength"); + String pLMNId = (String) gNB.get("pLMNId"); + String nFType = (String) gNB.get("nFType"); + Long nearRTRICId = (Long) gNB.get("nearRTRICId"); + String cellListVar = (String) gNB.get("cellCUList").toString(); + Object cellListObj = jsonParser.parse(cellListVar); + JSONArray cellList = (JSONArray) cellListObj; + List<NRCellCUModel> nRCellCUModelList = new ArrayList<NRCellCUModel>(); + for (int j = 0; j < cellList.size(); j++) { + JSONObject cell = (JSONObject) cellList.get(j); + Long cellLocalId = (Long) cell.get("cellLocalId"); + String plmVar = (String) cell.get("pLMNInfoList").toString(); + Object pmlVarObj = jsonParser.parse(plmVar); + JSONArray pmlList = (JSONArray) pmlVarObj; + List<PLMNInfoModel> plmnInfoModelList = new ArrayList<PLMNInfoModel>(); + for (int k = 0; k < pmlList.size(); k++) { + JSONObject pml = (JSONObject) pmlList.get(k); + String pLMNid = (String) pml.get("pLMNId"); + JSONObject sNSSAI = (JSONObject) pml.get("sNSSAI"); + String sNssai = (String) sNSSAI.get("sNSSAI"); + String status = (String) sNSSAI.get("status"); + JSONObject configData = (JSONObject) sNSSAI.get("configData"); + Long maxNumberOfConns = (Long) configData.get("maxNumberOfConns"); + NSSAIConfig configDataObj = new NSSAIConfig(); + configDataObj.setMaxNumberOfConns(maxNumberOfConns.intValue()); + NSSAIData nssaiData = new NSSAIData(); + nssaiData.setsNSSAI(sNssai); + nssaiData.setStatus(status); + nssaiData.setConfigData(configDataObj); + PLMNInfoModel plmnInfoModel = new PLMNInfoModel(); + plmnInfoModel.setpLMNId(pLMNid); + plmnInfoModel.setsNSSAI(nssaiData); + plmnInfoModelList.add(plmnInfoModel); + } + NRCellCUModel nrCellCUModel = new NRCellCUModel(); + nrCellCUModel.setCellLocalId(cellLocalId.intValue()); + nrCellCUModel.setpLMNInfoList(plmnInfoModelList); + nRCellCUModelList.add(nrCellCUModel); + } + GNBCUCPModel gNBModel = new GNBCUCPModel(); + gNBModel.setgNBCUName(gNBCUName); + gNBModel.setgNBId(gNBId.intValue()); + gNBModel.setgNBIdLength(gNBIdLength.intValue()); + gNBModel.setpLMNId(pLMNId); + gNBModel.setnFType(nFType); + gNBModel.setNearRTRICId(nearRTRICId.intValue()); + gNBModel.setCellCUList(nRCellCUModelList); + ranSliceConfigService.saveGNBCUCP(gNBModel); + } + } catch (Exception e) { + log.error("Properties file error", e); + } + } + } + } + for (GNBCUUPModel gNBCUUPModel : rtricModel.getgNBCUUPList()) { + gNBList.add(gNBCUUPModel.getgNBCUUPId().toString()); + setRanNetconfServers(gNBCUUPModel.getgNBCUUPId().toString()); + } + for (GNBDUModel gNBDUModel : rtricModel.getgNBDUList()) { + gNBList.add(gNBDUModel.getgNBDUId().toString()); + setRanNetconfServers(gNBDUModel.getgNBDUId().toString()); + } + unassignedrtRicIds.add(rtricModel.getNearRTRICId().toString()); + ricIdFunctionMapping.put(rtricModel.getNearRTRICId().toString(), gNBList); + setRanNetconfServers(rtricModel.getNearRTRICId().toString()); + } + } catch (Exception e) { + log.error("Properties file error", e); + } + } + + public void setRanNetconfServers(String serverId) { + try { + + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server == null) { + server = new NetconfServers(); + server.setServerId(serverId); + } + ransimRepo.mergeNetconfServers(server); + + } catch (Exception eu) { + log.error("setNetconfServers Function Error", eu); + + } + } + + /** + * The function adds the cell(with nodeId passed as an argument) to its netconf + * server list if the netconf server already exists. Else it will create a new + * netconf server in the NetconfServers Table and the cell into its list. + * + * @param nodeId node Id of the cell + */ + public void setNetconfServers(String nodeId) { + + CellDetails currentCell = ransimRepo.getCellDetail(nodeId); + + Set<CellDetails> newList = new HashSet<CellDetails>(); + try { + if (currentCell != null) { + NetconfServers server = ransimRepo.getNetconfServer(currentCell.getServerId()); + + if (server == null) { + + server = new NetconfServers(); + server.setServerId(currentCell.getServerId()); + } else { + newList.addAll(server.getCells()); + } + + newList.add(currentCell); + server.setCells(newList); + log.info("setNetconfServers: nodeId: " + nodeId + ", X:" + currentCell.getGridX() + ", Y:" + + currentCell.getGridY() + ", ip: " + server.getIp() + ", portNum: " + server.getNetconfPort() + + ", serverId:" + currentCell.getServerId()); + + ransimRepo.mergeNetconfServers(server); + + } + + } catch (Exception eu) { + log.error("setNetconfServers Function Error", eu); + + } + } + + /** + * generateClusterFromFile() + * + * @throws IOException + */ + public void generateClusterFromFile() throws IOException { + + log.debug("Inside generateClusterFromFile"); + File dumpFile = null; + String cellDetailsString = ""; + + dumpFile = new File(fileBasePath + dumpFileName); + + BufferedReader br = null; + try { + log.debug("Reading dump file"); + br = new BufferedReader(new FileReader(dumpFile)); + + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + cellDetailsString = sb.toString(); + + TopologyDump dumpTopo = new Gson().fromJson(cellDetailsString, TopologyDump.class); + CellDetails cellsDb = new CellDetails(); + + log.info("dumpTopo.getCellList().size():" + dumpTopo.getCellList().size()); + for (int i = 0; i < dumpTopo.getCellList().size(); i++) { + Gson g = new Gson(); + String pnt = g.toJson(dumpTopo.getCellList().get(i)); + log.info("Creating Cell:" + pnt); + log.info("Creating Cell:" + dumpTopo.getCellList().get(i).getCell().getNodeId()); + + cellsDb = new CellDetails(); + cellsDb.setNodeId(dumpTopo.getCellList().get(i).getCell().getNodeId()); + cellsDb.setPhysicalCellId(dumpTopo.getCellList().get(i).getCell().getPhysicalCellId()); + cellsDb.setLongitude(dumpTopo.getCellList().get(i).getCell().getLongitude()); + cellsDb.setLatitude(dumpTopo.getCellList().get(i).getCell().getLatitude()); + cellsDb.setServerId(dumpTopo.getCellList().get(i).getCell().getPnfName()); + if (!unassignedServerIds.contains(cellsDb.getServerId())) { + unassignedServerIds.add(cellsDb.getServerId()); + } + cellsDb.setNetworkId(dumpTopo.getCellList().get(i).getCell().getNetworkId()); + + double lon = Float.valueOf(dumpTopo.getCellList().get(i).getCell().getLongitude()); + double lat = Float.valueOf(dumpTopo.getCellList().get(i).getCell().getLatitude()); + + double xx = (lon - 0) * RansimUtilities.metersDeglon(0); + double yy = (lat - 0) * RansimUtilities.metersDeglat(0); + + double rad = Math.sqrt(xx * xx + yy * yy); + + if (rad > 0) { + double ct = xx / rad; + double st = yy / rad; + xx = rad * ((ct * Math.cos(0)) + (st * Math.sin(0))); + yy = rad * ((st * Math.cos(0)) - (ct * Math.sin(0))); + } + + cellsDb.setScreenX((float) (xx)); + cellsDb.setScreenY((float) (yy)); + + List<String> attachedNoeds = serverIdIpNodeMapping.get(cellsDb.getServerId()); + log.info("Attaching Cell:" + dumpTopo.getCellList().get(i).getCell().getNodeId() + " to " + + cellsDb.getServerId()); + if (attachedNoeds == null) { + attachedNoeds = new ArrayList<String>(); + } + attachedNoeds.add(cellsDb.getNodeId()); + serverIdIpNodeMapping.put(cellsDb.getServerId(), attachedNoeds); + if (attachedNoeds.size() > numberOfCellsPerNcServer) { + log.warn("Attaching Cell:" + dumpTopo.getCellList().get(i).getCell().getNodeId() + " to " + + cellsDb.getServerId() + ", But it is exceeding numberOfCellsPerNcServer " + + numberOfCellsPerNcServer); + } + ransimRepo.mergeCellDetails(cellsDb); + setNetconfServers(cellsDb.getNodeId()); + } + + dumpSessionDetails(); + + try { + + for (int i = 0; i < dumpTopo.getCellList().size(); i++) { + + String cellNodeId = dumpTopo.getCellList().get(i).getCell().getNodeId(); + + // neighbor list with the corresponding node id + CellNeighbor neighborList = ransimRepo.getCellNeighbor(cellNodeId); + // cell with the corresponding nodeId + CellDetails currentCell = ransimRepo.getCellDetail(cellNodeId); + + Set<NeighborDetails> newCell = new HashSet<NeighborDetails>(); + + if (currentCell != null) { + if (neighborList == null) { + neighborList = new CellNeighbor(); + neighborList.setNodeId(cellNodeId); + } + List<NbrDump> neighboursFromFile = dumpTopo.getCellList().get(i).getNeighbor(); + log.info("Creating Neighbor for Cell :" + cellNodeId); + for (NbrDump a : neighboursFromFile) { + String id = a.getNodeId().trim(); + boolean noHo = Boolean.parseBoolean(a.getBlacklisted().trim()); + CellDetails neighborCell = ransimRepo.getCellDetail(id); + NeighborDetails neighborDetails = new NeighborDetails( + new NeihborId(currentCell.getNodeId(), neighborCell.getNodeId()), noHo); + + newCell.add(neighborDetails); + } + + neighborList.setNeighborList(newCell); + ransimRepo.mergeCellNeighbor(neighborList); + rsPciHdlr.setCollisionConfusionFromFile(cellNodeId); + + } + + } + + } catch (Exception e1) { + log.error("Exception generateClusterFromFile :", e1); + } + + try { + + long startTimeSectorNumber = System.currentTimeMillis(); + for (int i = 0; i < dumpTopo.getCellList().size(); i++) { + + CellData icellData = dumpTopo.getCellList().get(i); + CellDetails icell = ransimRepo.getCellDetail(icellData.getCell().getNodeId()); + int icount = icell.getSectorNumber(); + if (icount == 0) { + log.info("Setting sectorNumber for Cell(i) :" + icell.getNodeId()); + int jcount = 0; + for (int j = (i + 1); j < dumpTopo.getCellList().size(); j++) { + + CellData jcellData = dumpTopo.getCellList().get(j); + if (icellData.getCell().getLatitude().equals(jcellData.getCell().getLatitude())) { + if (icellData.getCell().getLongitude().equals(jcellData.getCell().getLongitude())) { + + if (icount == 0) { + icount++; + jcount = icount + 1; + } + + CellDetails jcell = ransimRepo + .getCellDetail(dumpTopo.getCellList().get(j).getCell().getNodeId()); + + jcell.setSectorNumber(jcount); + log.info("Setting sectorNumber for Cell(j) :" + jcell.getNodeId() + " icell: " + + icell.getNodeId() + " Sector number: " + jcount); + ransimRepo.mergeCellDetails(jcell); + jcount++; + if (jcount > 3) { + break; + } + } + } + } + icell.setSectorNumber(icount); + ransimRepo.mergeCellDetails(icell); + } + + } + + long endTimeSectorNumber = System.currentTimeMillis(); + log.info("Time taken for setting sector number: " + (endTimeSectorNumber - startTimeSectorNumber)); + + } catch (Exception e3) { + log.error("Exception generateClusterFromFile :", e3); + } + + } catch (Exception e) { + log.error("Exception generateClusterFromFile :", e); + + } finally { + br.close(); + } + } + + /** + * The function deletes the cell from the database with the nodeId passed in the + * arguments. It removes the cell from its neighbor's neighbor list and the + * netconf server list. + * + * @param nodeId node Id of the cell to be deleted. + * @return returns success or failure message + */ + public String deleteCellFunction(String nodeId) { + String result = "failure node dosent exist"; + log.info("deleteCellFunction called with nodeId :" + nodeId); + + try { + CellDetails deleteCelldetail = ransimRepo.getCellDetail(nodeId); + + CellNeighbor deleteCellNeighbor = ransimRepo.getCellNeighbor(nodeId); + + if (deleteCelldetail != null) { + if (deleteCellNeighbor != null) { + List<CellNeighbor> cellNeighborList = ransimRepo.getCellNeighborList(); + for (CellNeighbor cellNeighbors : cellNeighborList) { + Set<NeighborDetails> currentCellNeighbors = + new HashSet<NeighborDetails>(cellNeighbors.getNeighborList()); + + NeihborId deleteNeighborDetail = + new NeihborId(cellNeighbors.getNodeId(), deleteCelldetail.getNodeId()); + + if (currentCellNeighbors.contains(deleteNeighborDetail)) { + log.info("Deleted Cell is Neighbor of NodeId : " + cellNeighbors.getNodeId()); + currentCellNeighbors.remove(deleteNeighborDetail); + cellNeighbors.setNeighborList(currentCellNeighbors); + ransimRepo.mergeCellNeighbor(cellNeighbors); + } + } + + deleteCellNeighbor.getNeighborList().clear(); + ransimRepo.deleteCellNeighbor(deleteCellNeighbor); + } + + ransimRepo.deleteCellDetails(deleteCelldetail); + result = "cell has been deleted from the database"; + } else { + log.info("cell id does not exist"); + result = "failure nodeId dosent exist"; + return result; + } + } catch (Exception eu) { + log.error("Exception deleteCellFunction :", eu); + result = "Exception in function"; + } + return result; + } + + /** + * Send configuration details to all the netconf server. + */ + public void sendInitialConfigAll() { + try { + dumpSessionDetails(); + List<NetconfServers> ncServers = ransimRepo.getNetconfServersList(); + for (NetconfServers netconfServers : ncServers) { + String ipPortKey = serverIdIpPortMapping.get(netconfServers.getServerId()); + if (ipPortKey == null || ipPortKey.trim().equals("")) { + log.info("No client for " + netconfServers.getServerId()); + for (String ipPortKeyStr : webSocketSessions.keySet()) { + if (!serverIdIpPortMapping.containsValue(ipPortKeyStr)) { + serverIdIpPortMapping.put(netconfServers.getServerId(), ipPortKeyStr); + ipPortKey = ipPortKeyStr; + break; + } + } + } + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + sendInitialConfig(netconfServers.getServerId()); + try { + String[] agentDetails = ipPortKey.split(":"); + new RestClient().sendMountRequestToSdnr(netconfServers.getServerId(), sdnrServerIp, + sdnrServerPort, agentDetails[0], agentDetails[1], sdnrServerUserid, + sdnrServerPassword); + } catch (Exception ex1) { + log.info("Ignoring exception", ex1); + } + + } else { + log.info("No session for " + ipPortKey); + } + } + } + } catch (Exception eu) { + log.error("Exception:", eu); + } + } + + public void sendRanInitialConfigAll() { + try { + List<NearRTRICModel> ncServers = ranSliceConfigService.findAllNearRTRIC(); + for (NearRTRICModel netconfServers : ncServers) { + String ipPortKey = serverIdIpPortMapping.get(netconfServers.getNearRTRICId()); + if (ipPortKey == null || ipPortKey.trim().equals("")) { + log.info("No client for " + netconfServers.getNearRTRICId()); + for (String ipPortKeyStr : webSocketSessions.keySet()) { + if (!serverIdIpPortMapping.containsValue(ipPortKeyStr)) { + serverIdIpPortMapping.put(netconfServers.getNearRTRICId().toString(), ipPortKeyStr); + ipPortKey = ipPortKeyStr; + break; + } + } + } + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + sendRanInitialConfig(netconfServers.getNearRTRICId().toString()); + try { + String[] agentDetails = ipPortKey.split(":"); + new RestClient().sendMountRequestToSdnr(netconfServers.getNearRTRICId().toString(), + sdnrServerIp, sdnrServerPort, agentDetails[0], agentDetails[1], sdnrServerUserid, + sdnrServerPassword); + } catch (Exception ex1) { + log.info("Ignoring exception", ex1); + } + + } else { + log.info("No session for " + ipPortKey); + } + } + } + } catch (Exception eu) { + log.error("Exception:", eu); + } + } + + /** + * Sends initial configuration details of the cells for a new netconf server + * that has been started. + * + * @param ipPortKey ip address details of the netconf server + */ + public void sendInitialConfigForNewAgent(String ipPortKey, String serverId) { + try { + dumpSessionDetails(); + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + if (serverId != null && !serverId.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + String[] agentDetails = ipPortKey.split(":"); + sendInitialConfig(serverId); + new RestClient().sendMountRequestToSdnr(serverId, sdnrServerIp, sdnrServerPort, agentDetails[0], + agentDetails[1], sdnrServerUserid, sdnrServerPassword); + + } else { + log.info("No session for " + ipPortKey); + } + } else { + log.info("No serverid for " + ipPortKey); + } + } else { + log.info("Invalid ipPortKey " + ipPortKey); + } + } catch (Exception eu) { + log.info("Exception:", eu); + } + } + + public void sendRanInitialConfigForNewAgent(String ipPortKey, String serverId) { + try { + if (ipPortKey != null && !ipPortKey.trim().equals("")) { + if (serverId != null && !serverId.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPortKey); + if (clSess != null) { + String[] agentDetails = ipPortKey.split(":"); + sendRanInitialConfig(serverId); + new RestClient().sendMountRequestToSdnr(serverId, sdnrServerIp, sdnrServerPort, agentDetails[0], + agentDetails[1], sdnrServerUserid, sdnrServerPassword); + } else { + log.info("No session for " + ipPortKey); + } + } else { + log.info("No serverid for " + ipPortKey); + } + } else { + log.info("Invalid ipPortKey " + ipPortKey); + } + } catch (Exception eu) { + log.info("Exception:", eu); + } + } + + public void sendRanInitialConfig(String serverId) { + + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + log.info("sendInitialConfig: serverId:" + serverId + ", server:" + server); + if (server == null) { + return; + } + + for (NearRTRICModel rtRicModel : rtricModelList) { + if (rtRicModel.getNearRTRICId().toString().equals(serverId)) { + getInitalConfigTree(rtRicModel, serverId); + NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin", server.getServerId(), + server.getIp(), Integer.parseInt(server.getNetconfPort())); + + netconfClient.editConfig(netconfClient.getInitialNodeSet(rtRicModel, serverId)); + } else { + for (Map.Entry<String, List<String>> entry : ricIdFunctionMapping.entrySet()) { + for (String value : entry.getValue()) { + if (value.equals(serverId) + && rtRicModel.getNearRTRICId().toString().equals(entry.getKey())) { + getInitalConfigTree(rtRicModel, serverId); + NetconfClient netconfClient = + new NetconfClient("ransim", "admin", "admin", server.getServerId(), + server.getIp(), Integer.parseInt(server.getNetconfPort())); + + netconfClient.editConfig(netconfClient.getInitialNodeSet(rtRicModel, serverId)); + } + } + } + } + } + + } catch (Exception eu) { + log.info("Exception:", eu); + } + + } + + /** + * Gets the initial config tree from the database. + */ + private void getInitalConfigTree(NearRTRICModel rtRicModel, String serverId) { + RanNetwork ranNetwork = new RanNetwork(); + List<NearRTRIC> nearRTRICList = new ArrayList<>(); + + NearRTRIC nearRTRIC = new NearRTRIC(); + nearRTRIC.setIdNearRTRIC(rtRicModel.getNearRTRICId().toString()); + Attributes attributes = new Attributes(); + attributes.setLocationName("Palmdale"); + attributes.setgNBId(rtRicModel.getgNBId().toString()); + nearRTRIC.setAttributes(attributes); + + List<GNBCUUPFunction> gNBCUUPFunctionList = new ArrayList<>(); + for (GNBCUUPModel gNBCUUPModel : rtRicModel.getgNBCUUPList()) { + if (gNBCUUPModel.getgNBCUUPId().toString().equals(serverId) + || rtRicModel.getNearRTRICId().toString().equals(serverId)) { + GNBCUUPFunction gNBCUUPFunction = new GNBCUUPFunction(); + Attributes cUUPattributes = new Attributes(); + cUUPattributes.setgNBCUUPId(gNBCUUPModel.getgNBCUUPId().toString()); + gNBCUUPFunction.setAttributes(cUUPattributes); + gNBCUUPFunction.setIdGNBCUUPFunction(gNBCUUPModel.getgNBCUUPId().toString()); + gNBCUUPFunctionList.add(gNBCUUPFunction); + } + } + List<GNBDUFunction> gNBDUFunctionList = new ArrayList<>(); + for (GNBDUModel gNBDUModel : rtRicModel.getgNBDUList()) { + if (gNBDUModel.getgNBDUId().toString().equals(serverId) + || rtRicModel.getNearRTRICId().toString().equals(serverId)) { + GNBDUFunction gNBDUFunction = new GNBDUFunction(); + Attributes dUattributes = new Attributes(); + dUattributes.setgNBId(gNBDUModel.getgNBId().toString()); + gNBDUFunction.setAttributes(dUattributes); + gNBDUFunction.setIdGNBDUFunction(gNBDUModel.getgNBDUId().toString()); + List<NRCellDU> nRCellDUList = new ArrayList<>(); + for (NRCellDUModel nRCellDUModel : gNBDUModel.getCellDUList()) { + NRCellDU nRCellDU = new NRCellDU(); + Attributes nRCellDUattributes = new Attributes(); + nRCellDUattributes.setOperationalState(nRCellDUModel.getOperationalState()); + nRCellDUattributes.setCellState(nRCellDUModel.getCellState()); + nRCellDU.setAttributes(nRCellDUattributes); + nRCellDU.setIdNRCellDU(nRCellDUModel.getCellLocalId().toString()); + nRCellDUList.add(nRCellDU); + } + gNBDUFunction.setnRCellDU(nRCellDUList); + gNBDUFunctionList.add(gNBDUFunction); + } + } + nearRTRIC.setgNBDUFunction(gNBDUFunctionList); + nearRTRIC.setgNBCUUPFunction(gNBCUUPFunctionList); + nearRTRICList.add(nearRTRIC); + ranNetwork.setNearRTRIC(nearRTRICList); + + String ipPortKey = serverIdIpPortMapping.get(serverId); + log.info("sendInitialConfig: ipPortKey:" + ipPortKey); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(ranNetwork); + log.info("ConfigTopologyMessage: " + jsonStr); + Session session = webSocketSessions.get(ipPortKey); + RansimWebSocketServer.sendSetConfigTopologyMessage(jsonStr, session); + } + + /** + * To send the initial configration to the netconf server. + * + * @param serverId ip address details of the netconf server + */ + public void sendInitialConfig(String serverId) { + + try { + NetconfServers server = ransimRepo.getNetconfServer(serverId); + log.info("sendInitialConfig: serverId:" + serverId + ", server:" + server); + if (server == null) { + return; + } + + String ipPortKey = serverIdIpPortMapping.get(serverId); + + log.info("sendInitialConfig: ipPortKey:" + ipPortKey); + + List<CellDetails> cellList = new ArrayList<CellDetails>(server.getCells()); + + List<Topology> config = new ArrayList<Topology>(); + + for (int i = 0; i < server.getCells().size(); i++) { + Topology cell = new Topology(); + CellDetails currentCell = ransimRepo.getCellDetail(cellList.get(i).getNodeId()); + CellNeighbor neighbor = ransimRepo.getCellNeighbor(cellList.get(i).getNodeId()); + + cell.setCellId("" + currentCell.getNodeId()); + cell.setPciId(currentCell.getPhysicalCellId()); + cell.setPnfName(serverId); + + List<Neighbor> nbrList = new ArrayList<Neighbor>(); + Set<NeighborDetails> nbrsDet = neighbor.getNeighborList(); + for (NeighborDetails cellDetails : nbrsDet) { + Neighbor nbr = new Neighbor(); + CellDetails nbrCell = ransimRepo.getCellDetail(cellDetails.getNeigbor().getNeighborCell()); + nbr.setNodeId(nbrCell.getNodeId()); + nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); + nbr.setPnfName(nbrCell.getServerId()); + nbr.setServerId(nbrCell.getServerId()); + nbr.setPlmnId(nbrCell.getNetworkId()); + nbr.setBlacklisted(cellDetails.isBlacklisted()); + nbrList.add(nbr); + } + cell.setNeighborList(nbrList); + config.add(i, cell); + } + + SetConfigTopology topo = new SetConfigTopology(); + + topo.setServerId(server.getServerId()); + String uuid = globalNcServerUuidMap.get(server.getServerId()); + if (uuid == null) { + uuid = getUuid(); + globalNcServerUuidMap.put(server.getServerId(), uuid); + } + topo.setUuid(uuid); + + topo.setTopology(config); + + Gson gson = new Gson(); + String jsonStr = gson.toJson(topo); + log.info("ConfigTopologyMessage: " + jsonStr); + Session clSess = webSocketSessions.get(ipPortKey); + Thread.sleep(10000); + RansimWebSocketServer.sendSetConfigTopologyMessage(jsonStr, clSess); + + } catch (Exception eu) { + log.info("Exception:", eu); + } + + } + + private static String getUuid() { + return UUID.randomUUID().toString(); + } + + /** + * The function alters the database information based on the modifications made + * in the SDNR. + * + * @param message message received from the SDNR + * @param session sends the session details + * @param ipPort ip address of the netconf server + */ + public void handleModifyPciFromSdnr(String message, Session session, String ipPort) { + log.info("handleModifyPciFromSDNR: message:" + message + " session:" + session + " ipPort:" + ipPort); + ModifyPci modifyPci = new Gson().fromJson(message, ModifyPci.class); + log.info("handleModifyPciFromSDNR: modifyPci:" + modifyPci.getCellId() + "; pci: " + modifyPci.getPciId()); + String source = "Netconf"; + CellDetails cd = ransimRepo.getCellDetail(modifyPci.getCellId()); + long pci = cd.getPhysicalCellId(); + cd.setPhysicalCellId(modifyPci.getPciId()); + ransimRepo.mergeCellDetails(cd); + rsPciHdlr.updatePciOperationsTable(modifyPci.getCellId(), source, pci, modifyPci.getPciId()); + } + + 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()) { + configData.setConfigValue((configData.getConfigValue()) / duCellCount); + } + } + 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); + } + } + + public void handleRRMPolicyRatioUpdateFromSdnr(String message, Session session, String ipPort) { + log.info("handle RRMPolicy update: " + message); + RRMPolicyRatio rRMPolicyRatio = new Gson().fromJson(message, RRMPolicyRatio.class); + rrmPolicyRepository.save(rRMPolicyRatio); + } + + public void handleRRMPolicyRatioDeleteFromSdnr(String message, Session session, String ipPort) { + log.info("handle RRMPolicyRatio Delete: " + message); + RRMPolicyRatio rRMPolicyRatio = new Gson().fromJson(message, RRMPolicyRatio.class); + rrmPolicyRepository.delete(rRMPolicyRatio); + } + + public void handlePLMNInfoUpdateFromSdnr(String message, Session session, String ipPort) { + log.info("handle PLMNInfo update: " + 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((int) (plmnInfoModel.getMaxNumberOfConns())); + 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); + 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(); + } else { + pLMNInfoList = new ArrayList<PLMNInfo>(); + } + 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(); + if (!(Objects.isNull(nrCellCu.getpLMNInfoList()))) { + pLMNInfoList = nrCellCu.getpLMNInfoList(); + } else { + pLMNInfoList = new ArrayList<PLMNInfo>(); + } + pLMNInfoList.add(plmnInfo); + nrCellCu.setpLMNInfoList(pLMNInfoList); + nRCellCURepository.save(nrCellCu); + } else { + org.onap.ransim.rest.api.models.GNBCUUPFunction gNBCUUPFunction = + gNBCUUPRepository.findById(plmnInfoModel.getGnbId()).get(); + if (!(Objects.isNull(gNBCUUPFunction.getpLMNInfoList()))) { + pLMNInfoList = gNBCUUPFunction.getpLMNInfoList(); + } else { + pLMNInfoList = new ArrayList<PLMNInfo>(); + } + pLMNInfoList.add(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 handlePLMNInfoDeleteFromSdnr(String message, Session session, String ipPort) { + log.info("handle PLMNInfo Delete: " + message); + 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((int) (plmnInfoModel.getMaxNumberOfConns())); + 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); + } + + public void handleSliceProfileUpdateFromSdnr(String message, Session session, String ipPort) { + log.info("handle SliceProfile update: " + message); + SliceProfile sliceProfile = new Gson().fromJson(message, SliceProfile.class); + sliceProfileRepository.save(sliceProfile); + } + + public void handleSliceProfileDeleteFromSdnr(String message, Session session, String ipPort) { + log.info("handle SliceProfile delete: " + message); + SliceProfile sliceProfile = new Gson().fromJson(message, SliceProfile.class); + sliceProfileRepository.delete(sliceProfile); + } + + /** + * The function alters the database information based on the modifications made + * in the SDNR. + * + * @param message message received from the SDNR + * @param session sends the session details + * @param ipPort ip address of the netconf server + */ + public void handleModifyNeighborFromSdnr(String message, Session session, String ipPort) { + log.info("handleModifyAnrFromSDNR: message:" + message + " session:" + session + " ipPort:" + ipPort); + ModifyNeighbor modifyNeighbor = new Gson().fromJson(message, ModifyNeighbor.class); + log.info("handleModifyAnrFromSDNR: modifyPci:" + modifyNeighbor.getCellId()); + List<NeighborDetails> neighborList = new ArrayList<NeighborDetails>(); + List<String> cellList = new ArrayList<String>(); + cellList.add(modifyNeighbor.getCellId()); + String nbrsAdd = ""; + String nbrsDel = ""; + String source = "Netconf"; + + for (int i = 0; i < modifyNeighbor.getNeighborList().size(); i++) { + if (modifyNeighbor.getNeighborList().get(i).isBlacklisted()) { + NeighborDetails nd = new NeighborDetails( + new NeihborId(modifyNeighbor.getCellId(), modifyNeighbor.getNeighborList().get(i).getNodeId()), + true); + ransimRepo.mergeNeighborDetails(nd); + cellList.add(modifyNeighbor.getNeighborList().get(i).getNodeId()); + if (nbrsAdd.equals("")) { + nbrsDel = modifyNeighbor.getNeighborList().get(i).getNodeId(); + } else { + nbrsDel += "," + modifyNeighbor.getNeighborList().get(i).getNodeId(); + } + } else { + NeighborDetails nd = new NeighborDetails( + new NeihborId(modifyNeighbor.getCellId(), modifyNeighbor.getNeighborList().get(i).getNodeId()), + false); + ransimRepo.mergeNeighborDetails(nd); + cellList.add(modifyNeighbor.getNeighborList().get(i).getNodeId()); + if (nbrsDel.equals("")) { + nbrsAdd = modifyNeighbor.getNeighborList().get(i).getNodeId(); + } else { + nbrsAdd += "," + modifyNeighbor.getNeighborList().get(i).getNodeId(); + } + } + + } + + for (String cl : cellList) { + rsPciHdlr.setCollisionConfusionFromFile(cl); + } + + log.info("neighbor list: " + neighborList); + + rsPciHdlr.updateNbrsOperationsTable(modifyNeighbor.getCellId(), source, nbrsAdd, nbrsDel); + } + + /** + * The function sends the modification made in the GUI to the netconf server. + * + * @param cellId node Id of the cell which was modified + * @param pciId PCI number of the cell which was modified + */ + public void handleModifyPciFromGui(String cellId, long pciId) { + log.info("handleModifyPciFromGUI: cellId:" + cellId + " pciId:" + pciId); + + try { + CellDetails currentCell = ransimRepo.getCellDetail(cellId); + CellNeighbor neighborList = ransimRepo.getCellNeighbor(cellId); + List<Neighbor> nbrList = new ArrayList<Neighbor>(); + Iterator<NeighborDetails> iter = neighborList.getNeighborList().iterator(); + while (iter.hasNext()) { + NeighborDetails nbCell = iter.next(); + Neighbor nbr = new Neighbor(); + CellDetails nbrCell = ransimRepo.getCellDetail(nbCell.getNeigbor().getNeighborCell()); + + nbr.setNodeId(nbrCell.getNodeId()); + nbr.setPhysicalCellId(nbrCell.getPhysicalCellId()); + nbr.setPnfName(nbrCell.getNodeName()); + nbr.setServerId(nbrCell.getServerId()); + nbr.setPlmnId(nbrCell.getNetworkId()); + nbrList.add(nbr); + } + + String pnfName = currentCell.getServerId(); + String ipPort = serverIdIpPortMapping.get(pnfName); + log.info("handleModifyPciFromGui:ipPort >>>>>>> " + ipPort); + + if (ipPort != null && !ipPort.trim().equals("")) { + + String[] ipPortArr = ipPort.split(":"); + Topology oneCell = new Topology(pnfName, pciId, cellId, nbrList); + UpdateCell updatedPci = new UpdateCell(currentCell.getServerId(), ipPortArr[0], ipPortArr[1], oneCell); + Gson gson = new Gson(); + String jsonStr = gson.toJson(updatedPci); + if (ipPort != null && !ipPort.trim().equals("")) { + Session clSess = webSocketSessions.get(ipPort); + if (clSess != null) { + RansimWebSocketServer.sendUpdateCellMessage(jsonStr, clSess); + log.info("handleModifyPciFromGui, message: " + jsonStr); + } else { + log.info("No client session for " + ipPort); + } + } else { + log.info("No client for " + currentCell.getServerId()); + } + } + + } catch (Exception eu) { + + log.error("Exception:", eu); + } + } + + /** + * The function unmounts the connection with SDNR. + * + * @return returns null value + */ + public String stopAllSimulation() { + try { + List<NetconfServers> ncServers = ransimRepo.getNetconfServersList(); + for (NetconfServers netconfServers : ncServers) { + try { + log.info("Unmount " + netconfServers.getServerId()); + new RestClient().sendUnmountRequestToSdnr(netconfServers.getServerId(), sdnrServerIp, + sdnrServerPort, sdnrServerUserid, sdnrServerPassword); + } catch (Exception e) { + log.error("Ignore Exception:", e); + } + serverIdIpNodeMapping.clear(); + } + return "Netconf servers unmounted."; + } catch (Exception eu) { + + log.error("Exception:", eu); + return "Error"; + } + } + + /** + * Used to dump session details. + */ + synchronized public static void dumpSessionDetails() { + + try { + + log.info("serverIdIpPortMapping.size:" + serverIdIpPortMapping.size() + "webSocketSessions.size" + + webSocketSessions.size()); + for (String key : serverIdIpPortMapping.keySet()) { + String val = serverIdIpPortMapping.get(key); + Session sess = webSocketSessions.get(val); + log.info("ServerId:" + key + " IpPort:" + val + " Session:" + sess); + } + for (String serverId : unassignedServerIds) { + log.info("Unassigned ServerId:" + serverId); + } + for (String serverId : serverIdIpPortMapping.keySet()) { + List<String> attachedNoeds = serverIdIpNodeMapping.get(serverId); + if (attachedNoeds != null) { + log.info("ServerId:" + serverId + " attachedNoeds.size:" + attachedNoeds.size() + " nodes:" + + attachedNoeds.toArray()); + } else { + log.info("ServerId:" + serverId + " attachedNoeds:" + null); + } + } + } catch (Exception e) { + log.info("Exception:", e); + } + } + +} + + +class KeepWebsockAliveThread extends Thread { + static Logger log = Logger.getLogger(KeepWebsockAliveThread.class.getName()); + RansimControllerServices rsCtrlrServices = null; + + KeepWebsockAliveThread(RansimControllerServices ctrlr) { + rsCtrlrServices = ctrlr; + } + + @Override + public void run() { + log.info("Inside KeepWebsockAliveThread run method"); + while (true) { + for (String ipPort : RansimControllerServices.webSocketSessions.keySet()) { + try { + Session sess = RansimControllerServices.webSocketSessions.get(ipPort); + RansimWebSocketServer.sendPingMessage(sess); + log.debug("Sent ping message to Client ipPort:" + ipPort); + } catch (Exception ex1) { + } + } + try { + Thread.sleep(10000); + } catch (InterruptedException ex) { + log.error("Thread interrupted"); + } + } + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java new file mode 100644 index 0000000..ecc76b3 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimRepositoryService.java @@ -0,0 +1,281 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.services; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.models.CellDetails; +import org.onap.ransim.rest.api.models.CellNeighbor; +import org.onap.ransim.rest.api.models.NeighborDetails; +import org.onap.ransim.rest.api.models.NetconfServers; +import org.onap.ransim.rest.api.models.OperationLog; +import org.onap.ransim.rest.api.repository.CellDetailsRepo; +import org.onap.ransim.rest.api.repository.CellNeighborRepo; +import org.onap.ransim.rest.api.repository.NeighborDetailsRepo; +import org.onap.ransim.rest.api.repository.NetconfServersRepo; +import org.onap.ransim.rest.api.repository.OperationLogRepo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class RansimRepositoryService { + + static Logger log = Logger.getLogger(RansimRepositoryService.class.getName()); + + @Autowired + CellDetailsRepo cellDetailsRepo; + + @Autowired + NetconfServersRepo netconfServersRepo; + + @Autowired + CellNeighborRepo cellNeighborRepo; + + @Autowired + NeighborDetailsRepo neighborDetailsRepo; + + @Autowired + OperationLogRepo operationLogRepo; + + /** + * Method to retrieve cell details + * + * @param nodeId + * @return + */ + public CellDetails getCellDetail(String nodeId) { + Optional<CellDetails> cd = cellDetailsRepo.findById(nodeId); + CellDetails cellDetails = null; + if (cd.isPresent()) { + cellDetails = cd.get(); + } + return cellDetails; + } + + /** + * Method to retrieve netconf server details + * + * @param serverId + * @return + */ + public NetconfServers getNetconfServer(String serverId) { + Optional<NetconfServers> serverDetails = netconfServersRepo.findById(serverId); + NetconfServers server = null; + if (serverDetails.isPresent()) { + server = serverDetails.get(); + } + return server; + } + + /** + * Method to retrieve cell neighbors + * + * @param nodeId + * @return + */ + public CellNeighbor getCellNeighbor(String nodeId) { + Optional<CellNeighbor> cellNeighborDetails = cellNeighborRepo.findById(nodeId); + CellNeighbor cellNeighbor = null; + if (cellNeighborDetails.isPresent()) { + cellNeighbor = cellNeighborDetails.get(); + } + return cellNeighbor; + } + + /** + * Method to retrieve all cell details + * + * @return + */ + public List<CellDetails> getCellDetailsList() { + Iterable<CellDetails> cellsList = cellDetailsRepo.findAll(); + if (cellsList != null) { + return (List<CellDetails>) cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve cells with no server ids + * + * @return + */ + public List<CellDetails> getCellsWithNoServerIds() { + List<CellDetails> cellsList = cellDetailsRepo.findCellsWithNoServerId(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve cell with collision or confusion + * + * @return + */ + public List<CellDetails> getCellsWithCollisionOrConfusion() { + List<CellDetails> cellsList = cellDetailsRepo.getCellsWithCollisionOrConfusion(); + if (cellsList != null) { + return cellsList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve operation log + * + * @return + */ + public List<OperationLog> getOperationLogList() { + Iterable<OperationLog> opLogList = operationLogRepo.findAll(); + if (opLogList != null) { + return (List<OperationLog>) opLogList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve all netconf servers + * + * @return + */ + public List<NetconfServers> getNetconfServersList() { + Iterable<NetconfServers> serversList = netconfServersRepo.findAll(); + if (serversList != null) { + return (List<NetconfServers>) serversList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to retrieve all cell neighbors + * + * @return + */ + public List<CellNeighbor> getCellNeighborList() { + Iterable<CellNeighbor> cellNeighborList = cellNeighborRepo.findAll(); + if (cellNeighborList != null) { + return (List<CellNeighbor>) cellNeighborList; + } else { + return new ArrayList<>(); + } + } + + /** + * Method to delete specific cells + * + * @param deleteCelldetail + */ + public void deleteCellDetails(CellDetails deleteCelldetail) { + + if (deleteCelldetail.getServerId() != null) { + NetconfServers ns = getNetconfServer(deleteCelldetail.getServerId()); + if (ns != null) { + ns.getCells().remove(deleteCelldetail); + netconfServersRepo.save(ns); + } + } + cellDetailsRepo.deleteById(deleteCelldetail.getNodeId()); + } + + /** + * Method to delete cell neighbors + * + * @param deleteCellNeighbor + */ + public void deleteCellNeighbor(CellNeighbor deleteCellNeighbor) { + cellNeighborRepo.deleteById(deleteCellNeighbor.getNodeId()); + } + + /** + * Method to delete all netconf servers + */ + public void deleteNetconfServers() { + netconfServersRepo.deleteAll(); + } + + /** + * Method to delete all cell neighbors + */ + public void deleteCellNeighbors() { + cellNeighborRepo.deleteAll(); + } + + /** + * Method to delete all cells + */ + public void deleteAllCellDetails() { + cellDetailsRepo.deleteAll(); + } + + /** + * Method to save cells + * + * @param cellDetail + */ + public void mergeCellDetails(CellDetails cellDetail) { + cellDetailsRepo.save(cellDetail); + } + + /** + * Method to save neighbors + * + * @param neighborDetails + */ + public void mergeNeighborDetails(NeighborDetails neighborDetails) { + neighborDetailsRepo.save(neighborDetails); + } + + /** + * Method to save netconf servers + * + * @param netconfServers + */ + public void mergeNetconfServers(NetconfServers netconfServers) { + netconfServersRepo.save(netconfServers); + } + + /** + * Method to save cell neighbors + * + * @param cellNeighbor + */ + public void mergeCellNeighbor(CellNeighbor cellNeighbor) { + cellNeighborRepo.save(cellNeighbor); + } + + /** + * Method to save operation log + * + * @param opLog + */ + public void mergeOperationLog(OperationLog opLog) { + operationLogRepo.save(opLog); + } +} 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 new file mode 100644 index 0000000..1a74c25 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java @@ -0,0 +1,259 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.services; + +import com.google.gson.Gson; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.websocket.Session; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.exceptions.RansimException; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.web.mapper.GNBDUModel; +import org.onap.ransim.rest.web.mapper.NRCellDUModel; +import org.onap.ransim.rest.web.mapper.NSSAIData; +import org.onap.ransim.rest.web.mapper.PLMNInfoModel; +import org.onap.ransim.rest.xml.models.FileFooter; +import org.onap.ransim.rest.xml.models.FileHeader; +import org.onap.ransim.rest.xml.models.FileSender; +import org.onap.ransim.rest.xml.models.GranularityPeriod; +import org.onap.ransim.rest.xml.models.Job; +import org.onap.ransim.rest.xml.models.ManagedElement; +import org.onap.ransim.rest.xml.models.MeasCollec; +import org.onap.ransim.rest.xml.models.MeasCollecEnd; +import org.onap.ransim.rest.xml.models.MeasCollecFile; +import org.onap.ransim.rest.xml.models.MeasData; +import org.onap.ransim.rest.xml.models.MeasInfo; +import org.onap.ransim.rest.xml.models.MeasType; +import org.onap.ransim.rest.xml.models.MeasValue; +import org.onap.ransim.rest.xml.models.ReportingPeriod; +import org.onap.ransim.rest.xml.models.Result; +import org.onap.ransim.websocket.model.SlicingPmMessage; +import org.onap.ransim.websocket.server.RansimWebSocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class SlicingPMDataGenerator { + + static Logger logger = Logger.getLogger(SlicingPMDataGenerator.class.getName()); + + @Autowired + RANSliceConfigService ranSliceConfigService; + + double ricId11MaxVariation = 0.8; + double ricId22MaxVariation = 0.2; + + /** + * Generates closed loop PM data for all DU functions Generates PRBs for DUs in + * the ratio of 80:20 for the same nssai in different RICs + * + * @throws RansimException + */ + public void generateClosedLoopPmData(long startTime) { + try { + String requestUrl = "http://" + "localhost" + ":" + "8081" + "/ransim/api/ransim-db/v4/du-list"; + List<GNBDUModel> duList = sendGetRequestToransimDb(requestUrl).getBody(); + for (GNBDUModel du : duList) { + logger.info("Generating PM data for DU : " + du.getgNBDUName() + " Id :" + du.getgNBDUId()); + Map<String, NSSAIConfig> activeNssaiDetails = new HashMap<String, NSSAIConfig>(); + List<NRCellDUModel> duCellList = du.getCellDUList(); + int ricId = du.getNearRTRICId(); + List<PLMNInfoModel> plmnInfoList = new ArrayList<>(); + 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")) + .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()); + } + } catch (RansimException e) { + logger.debug("ERROR in closed lopp PM data generation : "); + logger.debug(e); + } catch (Exception exp) { + logger.debug(exp); + } + } + + private void produceMeasurementCollectionFile(GNBDUModel du, Map<String, NSSAIConfig> activeNssaiDetails, + List<NRCellDUModel> duCellList, int ricId) throws RansimException { + logger.debug("produceing MeasurementCollectionFile "); + SlicingPmMessage pmMessage = new SlicingPmMessage(); + pmMessage.setStartEpochMicrosec(System.currentTimeMillis() * 1000); + pmMessage.setSourceName(du.getgNBDUName()); + LocalDateTime beginTime = LocalDateTime.now(); + String beginTimeString = beginTime.toString(); + MeasCollec measCollec = new MeasCollec(beginTimeString); + FileSender fileSender = new FileSender(du.getgNBDUName()); + FileHeader fileHeader = new FileHeader("Prefix", "Acme Ltd", "32.435 V10.0", measCollec, fileSender); + Random r = new Random(); + int jobId = r.nextInt((9999 - 1000) + 1) + 1000; + Job job = new Job(String.valueOf(jobId)); + ReportingPeriod reportingPeriod = new ReportingPeriod("PT900S"); + + List<MeasType> measTypeList = setMeasurementTypes(activeNssaiDetails); + List<MeasValue> measValueList = setMeasurementValues(duCellList, getMaxVariation(ricId), measTypeList); + + ManagedElement managedElement = new ManagedElement("r0.1", du.getgNBDUName()); + LocalDateTime grabularityEndTime = LocalDateTime.now(); + String grabularityEndTimeString = grabularityEndTime.toString(); + GranularityPeriod granularityPeriod = new GranularityPeriod(grabularityEndTimeString, "PT900S"); + MeasInfo measInfo = + new MeasInfo("measInfoIsVal", job, granularityPeriod, reportingPeriod, measTypeList, measValueList); + List<MeasInfo> measInfoList = new ArrayList<MeasInfo>(); + measInfoList.add(measInfo); + MeasData measData = new MeasData(managedElement, measInfoList); + List<MeasData> measDataList = new ArrayList<MeasData>(); + measDataList.add(measData); + LocalDateTime endTime = LocalDateTime.now(); + String endTimeString = endTime.toString(); + pmMessage.setLastEpochMicrosec(System.currentTimeMillis() * 1000); + MeasCollecEnd measCollecEnd = new MeasCollecEnd(endTimeString); + FileFooter fileFooter = new FileFooter(measCollecEnd); + MeasCollecFile measCollecFile = new MeasCollecFile(fileHeader, measDataList, fileFooter, + "http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"); + + try { + String startDate = beginTimeString.replace(':', '-'); + String endDate = endTimeString.replace(':', '-'); + String fileName = + "A" + startDate + "-" + endDate + "-" + String.valueOf(jobId) + "-" + du.getgNBDUName() + ".xml"; + pmMessage.setFileName(fileName); + Gson gson = new Gson(); + String pmData = gson.toJson(measCollecFile); + pmMessage.setPmData(pmData); + closedLoopPmData(pmMessage); + } catch (Exception exp) { + logger.debug(exp); + } + + } + + private List<MeasValue> setMeasurementValues(List<NRCellDUModel> duCellList, double ricIdVariation, + List<MeasType> measTypeList) { + logger.debug("setting MeasurementValues"); + List<MeasValue> measValueList = new ArrayList<MeasValue>(); + duCellList.forEach(cell -> { + AtomicInteger pValue = new AtomicInteger(1); + List<Result> resultList = new ArrayList<>(); + int prbs = cell.getPrbs(); + measTypeList.forEach(meas -> { + int prbsUsed = (int) (Math.random() * ricIdVariation * prbs); + Result result = new Result(pValue.getAndIncrement(), prbsUsed); + resultList.add(result); + }); + MeasValue measValue = new MeasValue(cell.getCellLocalId(), resultList, false); + measValueList.add(measValue); + + }); + return measValueList; + } + + private double getMaxVariation(int ricId) throws RansimException { + switch (ricId) { + case 11: + // ricId11MaxVariation = + // Double.parseDouble(System.getProperty("RIC_11_VARIATION")); + return ricId11MaxVariation; + case 22: + return ricId22MaxVariation; + default: + throw new RansimException("Invalid RIC ID : valid Ids : [11,22] "); + } + } + + private List<MeasType> setMeasurementTypes(Map<String, NSSAIConfig> activeNssaiDetails) { + logger.debug("setting MeasurementTypes"); + List<MeasType> measTypeList = new ArrayList<MeasType>(); + AtomicInteger pValue = new AtomicInteger(1); + activeNssaiDetails.forEach((nssai, configData) -> { + MeasType mesType1 = new MeasType("SM.PrbUsedDl." + nssai, pValue.getAndIncrement()); + MeasType mesType2 = new MeasType("SM.PrbUsedUl." + nssai, pValue.getAndIncrement()); + measTypeList.add(mesType1); + measTypeList.add(mesType2); + }); + return measTypeList; + } + + public static <T> ResponseEntity<List<GNBDUModel>> sendGetRequestToransimDb(String requestUrl) { + HttpHeaders headers = new HttpHeaders(); + logger.info("sending request to ransimdb : " + requestUrl); + headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); + HttpEntity<Void> requestEntity = new HttpEntity<>(headers); + try { + RestTemplate restTemplate = new RestTemplate(); + return restTemplate.exchange(requestUrl, HttpMethod.GET, requestEntity, + new ParameterizedTypeReference<List<GNBDUModel>>() {}); + } catch (Exception e) { + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } + } + + public void closedLoopPmData(SlicingPmMessage pmMessage) { + Gson gson = new Gson(); + String jsonStr = gson.toJson(pmMessage); + logger.info("ClosedPmData " + jsonStr); + String ipPort = RansimControllerServices.serverIdIpPortMapping.get(pmMessage.getSourceName()); + if (ipPort != null && !ipPort.trim().equals("")) { + logger.info("Connection estabilished with ip: " + ipPort); + if (ipPort != null && !ipPort.trim().equals("")) { + Session clSess = RansimControllerServices.webSocketSessions.get(ipPort); + if (clSess != null) { + logger.info("PM Data message sent."); + RansimWebSocketServer.sendIntelligentSlicingPmData(jsonStr, clSess); + } else { + logger.info("No client session for " + ipPort); + } + } else { + logger.info("No client for this serverId"); + } + } else { + logger.info("No client for "); + } + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java index 9e56045..eb4d87f 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/client/RestClient.java @@ -20,22 +20,82 @@ package org.onap.ransim.rest.client; +import java.io.*; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.URL; import java.nio.charset.Charset; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; import java.util.List; import java.util.Map; +import javax.net.ssl.*; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.http.client.HttpClient; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLContextBuilder; +import org.apache.http.conn.ssl.TrustSelfSignedStrategy; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; import org.apache.log4j.Logger; import org.eclipse.persistence.internal.oxm.conversion.Base64; -import org.onap.ransim.rest.api.controller.RansimControllerServices; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; public class RestClient { - static Logger log = Logger.getLogger(RansimControllerServices.class.getName()); + private static class NullHostnameVerifier implements HostnameVerifier { + public boolean verify(String hostname, SSLSession session) { + return true; + } + } + private static class SavingTrustManager implements X509TrustManager { + + private final X509TrustManager tm; + private X509Certificate[] chain; + + SavingTrustManager(X509TrustManager tm) { + this.tm = tm; + } + + public X509Certificate[] getAcceptedIssuers() { + + return new X509Certificate[0]; + + } + + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + throw new UnsupportedOperationException(); + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + this.chain = chain; + tm.checkServerTrusted(chain, authType); + } + } + + static Logger log = Logger.getLogger(RestClient.class.getName()); HttpHeaders createHeaders(String username, String password) { return new HttpHeaders() { @@ -55,40 +115,115 @@ public class RestClient { * Sends mount request to sdnr. * * @param serverId - * netconf server id name + * netconf server id name * @param ip - * server ip address + * server ip address * @param port - * port number + * port number * @param agentIp - * agent ip address + * agent ip address * @param agentPort - * agent port number + * agent port number * @param agentUsername - * agent username + * agent username * @param agentPassword - * agent password + * agent password * @return returns the message to be passed */ + public String sendMountRequestToSdnr(String serverId, String ip, int port, String agentIp, String agentPort, String agentUsername, String agentPassword) { - String requestBody = "<node xmlns=\"urn:TBD:params:xml:ns:yang:network-topology\"> <node-id> " + serverId + " </node-id> <username xmlns=\"urn:opendaylight:netconf-node-topology\">admin</username> <password xmlns=\"urn:opendaylight:netconf-node-topology\">admin</password> <host xmlns=\"urn:opendaylight:netconf-node-topology\">" + agentIp + "</host> <schema-cache-directory xmlns=\"urn:opendaylight:netconf-node-topology\">" + serverId + "</schema-cache-directory> <port xmlns=\"urn:opendaylight:netconf-node-topology\">" + agentPort + "</port> <tcp-only xmlns=\"urn:opendaylight:netconf-node-topology\">false</tcp-only> <schemaless xmlns=\"urn:opendaylight:netconf-node-topology\">false</schemaless> <max-connection-attempts xmlns=\"urn:opendaylight:netconf-node-topology\">0</max-connection-attempts> <connection-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">20000</connection-timeout-millis> <default-request-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">60000</default-request-timeout-millis> <sleep-factor xmlns=\"urn:opendaylight:netconf-node-topology\">1.1</sleep-factor> <between-attempts-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">2000</between-attempts-timeout-millis> <reconnect-on-changed-schema xmlns=\"urn:opendaylight:netconf-node-topology\">false</reconnect-on-changed-schema> <keepalive-delay xmlns=\"urn:opendaylight:netconf-node-topology\">60</keepalive-delay> <concurrent-rpc-limit xmlns=\"urn:opendaylight:netconf-node-topology\">0</concurrent-rpc-limit> <actor-response-wait-time xmlns=\"urn:opendaylight:netconf-node-topology\">60</actor-response-wait-time></node>"; - HttpHeaders headers = createHeaders(agentUsername, agentPassword); + ResponseEntity<String> result = null; + try { + String requestBody = "<node xmlns=\"urn:TBD:params:xml:ns:yang:network-topology\"> <node-id> " + serverId + + " </node-id> <username xmlns=\"urn:opendaylight:netconf-node-topology\">admin</username> <password xmlns=\"urn:opendaylight:netconf-node-topology\">admin</password> <host xmlns=\"urn:opendaylight:netconf-node-topology\">" + + agentIp + "</host> <schema-cache-directory xmlns=\"urn:opendaylight:netconf-node-topology\">" + + serverId + "</schema-cache-directory> <port xmlns=\"urn:opendaylight:netconf-node-topology\">" + + agentPort + + "</port> <tcp-only xmlns=\"urn:opendaylight:netconf-node-topology\">false</tcp-only> <schemaless xmlns=\"urn:opendaylight:netconf-node-topology\">false</schemaless> <max-connection-attempts xmlns=\"urn:opendaylight:netconf-node-topology\">0</max-connection-attempts> <connection-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">20000</connection-timeout-millis> <default-request-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">60000</default-request-timeout-millis> <sleep-factor xmlns=\"urn:opendaylight:netconf-node-topology\">1.1</sleep-factor> <between-attempts-timeout-millis xmlns=\"urn:opendaylight:netconf-node-topology\">2000</between-attempts-timeout-millis> <reconnect-on-changed-schema xmlns=\"urn:opendaylight:netconf-node-topology\">false</reconnect-on-changed-schema> <keepalive-delay xmlns=\"urn:opendaylight:netconf-node-topology\">60</keepalive-delay> <concurrent-rpc-limit xmlns=\"urn:opendaylight:netconf-node-topology\">0</concurrent-rpc-limit> <actor-response-wait-time xmlns=\"urn:opendaylight:netconf-node-topology\">60</actor-response-wait-time></node>"; + + String response = ""; + HttpsURLConnection connection = null; + BufferedReader br = null; + log.info("Change in http to https"); + char[] passphrase; + String p = "changeit"; + passphrase = p.toCharArray(); + File file = new File("jssecacerts"); + if (file.isFile() == false) { + char SEP = File.separatorChar; + File dir = new File(SEP + "tmp" + SEP + "ransim-install" + SEP + "config"); + file = new File(dir, "jssecacerts"); + } + log.info("Loading new KeyStores" + file + "..."); + InputStream in = new FileInputStream(file); + KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); + ks.load(in, passphrase); + in.close(); + SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).loadKeyMaterial(ks, passphrase).build(), + NoopHostnameVerifier.INSTANCE); + + HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build(); + + ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); - log.info("request : " + requestBody); - log.info("headers : " + headers); - for (Map.Entry<String, List<String>> entry : headers.entrySet()) { - log.info("Key:" + entry.getKey() + " , Value:" + entry.getValue()); + SSLContext context = SSLContext.getInstance("TLS"); + TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + tmf.init(ks); + X509TrustManager defaultTrustManager = (X509TrustManager) tmf.getTrustManagers()[0]; + SavingTrustManager tm = new SavingTrustManager(defaultTrustManager); + context.init(null, new TrustManager[] {tm}, null); + + SSLContext.setDefault(context); + SSLSocketFactory factory = context.getSocketFactory(); + + log.info("Using Authorization"); + + SSLSocket socket = (SSLSocket) factory.createSocket(ip, port); + socket.setSoTimeout(10000); + + try { + socket.startHandshake(); + } catch (SSLException e) { + + log.error("Exc insocket handshake", e); + + } + + log.info("Started SSL handshake without hostname verifier..."); + + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpClientBuilder httpClientBuilder = HttpClients.custom().setSSLContext(SSLContext.getDefault()) + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE).useSystemProperties(); + + restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build())); + + HttpHeaders headers = createHeaders(agentUsername, agentPassword); + + log.info("request : " + requestBody); + log.info("headers : " + headers); + for (Map.Entry<String, List<String>> entry : headers.entrySet()) { + log.info("Key:" + entry.getKey() + " , Value:" + entry.getValue()); + } + String url = "https://" + ip + ":" + port + + "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + serverId; + + HttpEntity<String> entity = new HttpEntity<String>(requestBody, headers); + result = restTemplate.exchange(url, HttpMethod.PUT, entity, String.class); + + log.info("Request sent, result: " + result); + socket.close(); + } catch (SSLException e) { + System.out.println(); + e.printStackTrace(System.out); } - RestTemplate restTemplate = new RestTemplate(); - String url = "http://" + ip + ":" + port - + "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + serverId; - HttpEntity<String> entity = new HttpEntity<String>(requestBody, headers); - ResponseEntity<String> result = restTemplate.exchange(url, HttpMethod.PUT, entity, String.class); + catch (Exception e) { - log.info("request sent, result: " + result); + log.error("Exc in post {}", e); + } return result.toString(); } @@ -96,15 +231,15 @@ public class RestClient { * Sends an unmount request to sdnr. * * @param serverId - * netconf server id name + * netconf server id name * @param ip - * ip address + * ip address * @param port - * port number + * port number * @param sdnrUsername - * sdnr username + * sdnr username * @param sdnrPassword - * sdnr password + * sdnr password * @return returns the message to be passed */ public String sendUnmountRequestToSdnr(String serverId, String ip, int port, String sdnrUsername, diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java index 6e57945..c74f5b7 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestConfig.java @@ -27,12 +27,10 @@ import java.util.Properties; import javax.annotation.PostConstruct; import javax.servlet.MultipartConfigElement; +import org.apache.log4j.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; @@ -43,10 +41,10 @@ import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration -@EnableWebMvc @EnableSwagger2 -@ComponentScan(basePackages = { "org.onap.*", "com.*" }) -public class RansimRestConfig extends WebMvcConfigurerAdapter { +@ComponentScan(basePackages = {"org.onap.*", "com.*"}) +public class RansimRestConfig { + private static final Logger log = Logger.getLogger(RansimRestConfig.class); /** * init. @@ -58,16 +56,10 @@ public class RansimRestConfig extends WebMvcConfigurerAdapter { // load a properties file prop.load(input); } catch (Exception e) { - System.out.println("Exception Occured while loading properties file" + e); + log.error("Exception Occured while loading properties file : {} ", e); } } - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - } - private ApiInfo apiInfo() { return new ApiInfoBuilder().title("Ran Simulator Controller REST API") .description("This API helps to make queries against Ran Simulator Controller").version("3.0").build(); @@ -93,7 +85,7 @@ public class RansimRestConfig extends WebMvcConfigurerAdapter { @Bean public MultipartConfigElement multipartConfigElement() { String location = System.getProperty("java.io.tmpdir"); - MultipartConfigElement mp = new MultipartConfigElement(location); - return mp; + return new MultipartConfigElement(location); } + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestInitializer.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestInitializer.java deleted file mode 100644 index 427e871..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/config/RansimRestInitializer.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2020 Wipro Limited. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.ransim.rest.config; - -import javax.servlet.MultipartConfigElement; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; - -import org.springframework.web.WebApplicationInitializer; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.servlet.DispatcherServlet; - -/** - * REST API configuration initialization. - * - * @version 0.1 - */ -public class RansimRestInitializer implements WebApplicationInitializer { - @Override - public void onStartup(ServletContext container) throws ServletException { - AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); - ctx.register(RansimRestConfig.class); - ctx.setServletContext(container); - ctx.refresh(); - ServletRegistration.Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(ctx)); - servlet.setLoadOnStartup(1); - servlet.addMapping("/api/*"); - servlet.setMultipartConfig(ctx.getBean(MultipartConfigElement.class)); - } -} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellData.java new file mode 100644 index 0000000..ae8ffea --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellData.java @@ -0,0 +1,114 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +public class CellData { + private String networkId; + private String nodeId; + private Long physicalCellId; + private String pnfId; + private String sectorNumber; + private String latitude; + private String longitude; + private String notes; + + public CellData() { + + } + + public CellData(String networkId, String nodeId, Long physicalCellId, String pnfId, String sectorNumber, + String latitude, String longitude, String notes) { + super(); + this.networkId = networkId; + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + this.pnfId = pnfId; + this.sectorNumber = sectorNumber; + this.latitude = latitude; + this.longitude = longitude; + this.notes = notes; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public Long getPhysicalCellId() { + return physicalCellId; + } + + public void setPhysicalCellId(Long physicalCellId) { + this.physicalCellId = physicalCellId; + } + + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getSectorNumber() { + return sectorNumber; + } + + public void setSectorNumber(String sectorNumber) { + this.sectorNumber = sectorNumber; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellInputPayload.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellInputPayload.java new file mode 100644 index 0000000..44a2777 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellInputPayload.java @@ -0,0 +1,37 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class CellInputPayload { + + List<CellObj> cellList; + + public List<CellObj> getCellList() { + return cellList; + } + + public void setCellList(List<CellObj> cellList) { + this.cellList = cellList; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellNbrInfoResponse.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellNbrInfoResponse.java new file mode 100644 index 0000000..65d9a9f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellNbrInfoResponse.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import javax.persistence.Column; + +public class CellNbrInfoResponse { + + @JsonProperty("cellId") + private String cellId; + + @JsonProperty("targetCellId") + private String targetCellId; + + private boolean ho; + + public CellNbrInfoResponse(String cellId, String targetCellId, boolean ho) { + this.cellId = cellId; + this.targetCellId = targetCellId; + this.ho = ho; + + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public String getTargetCellId() { + return targetCellId; + } + + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + + public boolean isHo() { + return ho; + } + + public void setHo(boolean ho) { + this.ho = ho; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellObj.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellObj.java new file mode 100644 index 0000000..f4bb6cf --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellObj.java @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class CellObj { + + @JsonProperty("Cell") + private CellData cell; + + private List<String> neighbor; + + public CellData getCell() { + return cell; + } + + public void setCell(CellData cell) { + this.cell = cell; + } + + public List<String> getNeighbor() { + return neighbor; + } + + public void setNeighbor(List<String> neighbor) { + this.neighbor = neighbor; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellPciValueObj.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellPciValueObj.java new file mode 100644 index 0000000..8e7c77d --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/CellPciValueObj.java @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +public class CellPciValueObj { + + private String cellId; + private long pciValue; + + public CellPciValueObj(String cellId, long pciValue) { + super(); + this.cellId = cellId; + this.pciValue = pciValue; + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public long getPciValue() { + return pciValue; + } + + public void setPciValue(long pciValue) { + this.pciValue = pciValue; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/ErrorData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/ErrorData.java new file mode 100644 index 0000000..605e2df --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/ErrorData.java @@ -0,0 +1,55 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +public enum ErrorData { + NO_DATA_FOUND("404", "No Data Found"), DATA_NOT_STORED("500", "Data not Saved"), UNEXPECTED_ERROR("500", + "Exception Occured during the Operation"); + + private String errorCode; + private String errorMessage; + + ErrorData(String errorCode, String errorMessage) { + this.errorCode = errorCode; + this.errorMessage = errorMessage; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public String toString() { + return "ErrorData [errorCode=" + errorCode + ", errorMessage=" + errorMessage + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUCPModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUCPModel.java new file mode 100644 index 0000000..1d538b6 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUCPModel.java @@ -0,0 +1,97 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class GNBCUCPModel { + private String gNBCUName; + private Integer gNBId; + private Integer gNBIdLength; + private String pLMNId; + private String nFType; + private List<NRCellCUModel> cellCUList; + private Integer nearRTRICId; + + public String getgNBCUName() { + return gNBCUName; + } + + public void setgNBCUName(String gNBCUName) { + this.gNBCUName = gNBCUName; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public Integer getgNBIdLength() { + return gNBIdLength; + } + + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public List<NRCellCUModel> getCellCUList() { + return cellCUList; + } + + public void setCellCUList(List<NRCellCUModel> cellCUList) { + this.cellCUList = cellCUList; + } + + public Integer getNearRTRICId() { + return nearRTRICId; + } + + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + + public String getnFType() { + return nFType; + } + + public void setnFType(String nFType) { + this.nFType = nFType; + } + + @Override + public String toString() { + return "GNBCUCPModel [gNBCUName=" + gNBCUName + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + + ", pLMNId=" + pLMNId + ", nFType=" + nFType + ", cellCUList=" + cellCUList + ", nearRTRICId=" + + nearRTRICId + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUUPModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUUPModel.java new file mode 100644 index 0000000..4b750b0 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBCUUPModel.java @@ -0,0 +1,109 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +import org.onap.ransim.rest.api.models.NearRTRIC; +import org.onap.ransim.rest.api.models.PLMNInfo; + +public class GNBCUUPModel { + private Integer gNBCUUPId; + private Integer gNBId; + private Integer gNBIdLength; + private List<PLMNInfoModel> pLMNInfoList; + private String resourceType; + private String metricKey; + private Integer metricValue; + private Integer nearRTRICId; + + public Integer getgNBCUUPId() { + return gNBCUUPId; + } + + public void setgNBCUUPId(Integer gNBCUUPId) { + this.gNBCUUPId = gNBCUUPId; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public Integer getgNBIdLength() { + return gNBIdLength; + } + + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public String getMetricKey() { + return metricKey; + } + + public void setMetricKey(String metricKey) { + this.metricKey = metricKey; + } + + public Integer getMetricValue() { + return metricValue; + } + + public void setMetricValue(Integer metricValue) { + this.metricValue = metricValue; + } + + public List<PLMNInfoModel> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfoModel> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + public Integer getNearRTRICId() { + return nearRTRICId; + } + + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + + @Override + public String toString() { + return "GNBCUUPModel [gNBCUUPId=" + gNBCUUPId + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + + ", pLMNInfoList=" + pLMNInfoList + ", resourceType=" + resourceType + ", metricKey=" + metricKey + + ", metricValue=" + metricValue + ", nearRTRICId=" + nearRTRICId + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBDUModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBDUModel.java new file mode 100644 index 0000000..8e2ba96 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/GNBDUModel.java @@ -0,0 +1,105 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class GNBDUModel { + private Integer gNBDUId; + private Integer gNBId; + private Integer gNBIdLength; + private String gNBDUName; + private String pLMNId; + private String nFType; + private List<NRCellDUModel> cellDUList; + private Integer nearRTRICId; + + public Integer getgNBDUId() { + return gNBDUId; + } + + public void setgNBDUId(Integer gNBDUId) { + this.gNBDUId = gNBDUId; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public Integer getgNBIdLength() { + return gNBIdLength; + } + + public void setgNBIdLength(Integer gNBIdLength) { + this.gNBIdLength = gNBIdLength; + } + + public String getgNBDUName() { + return gNBDUName; + } + + public void setgNBDUName(String gNBDUName) { + this.gNBDUName = gNBDUName; + } + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public List<NRCellDUModel> getCellDUList() { + return cellDUList; + } + + public void setCellDUList(List<NRCellDUModel> cellDUList) { + this.cellDUList = cellDUList; + } + + public Integer getNearRTRICId() { + return nearRTRICId; + } + + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + + public String getnFType() { + return nFType; + } + + public void setnFType(String nFType) { + this.nFType = nFType; + } + + @Override + public String toString() { + return "GNBDUModel [gNBDUId=" + gNBDUId + ", gNBId=" + gNBId + ", gNBIdLength=" + gNBIdLength + ", gNBDUName=" + + gNBDUName + ", pLMNId=" + pLMNId + ", nFType=" + nFType + ", cellDUList=" + cellDUList + + ", nearRTRICId=" + nearRTRICId + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellCUModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellCUModel.java new file mode 100644 index 0000000..0ee438b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellCUModel.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class NRCellCUModel { + private Integer cellLocalId; + private List<PLMNInfoModel> pLMNInfoList; + private String resourceType; + + public Integer getCellLocalId() { + return cellLocalId; + } + + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + + public List<PLMNInfoModel> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfoModel> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + @Override + public String toString() { + return "NRCellCUModel [cellLocalId=" + cellLocalId + ", pLMNInfoList=" + pLMNInfoList + ", resourceType=" + + resourceType + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellDUModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellDUModel.java new file mode 100644 index 0000000..3e3576a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NRCellDUModel.java @@ -0,0 +1,118 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +import javax.persistence.Column; + +public class NRCellDUModel { + private Integer cellLocalId; + private String operationalState; + private String administrativeState; + private String cellState; + private List<PLMNInfoModel> pLMNInfoList; + private Integer nRPCI; + private Integer nRTAC; + private String resourceType; + private Integer prbs; + + public Integer getCellLocalId() { + return cellLocalId; + } + + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } + + public List<PLMNInfoModel> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfoModel> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + public String getOperationalState() { + return operationalState; + } + + public void setOperationalState(String operationalState) { + this.operationalState = operationalState; + } + + public String getAdministrativeState() { + return administrativeState; + } + + public void setAdministrativeState(String administrativeState) { + this.administrativeState = administrativeState; + } + + public String getCellState() { + return cellState; + } + + public void setCellState(String cellState) { + this.cellState = cellState; + } + + public Integer getnRPCI() { + return nRPCI; + } + + public void setnRPCI(Integer nRPCI) { + this.nRPCI = nRPCI; + } + + public Integer getnRTAC() { + return nRTAC; + } + + public void setnRTAC(Integer nRTAC) { + this.nRTAC = nRTAC; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public Integer getPrbs() { + return prbs; + } + + public void setPrbs(Integer prbs) { + this.prbs = prbs; + } + + @Override + public String toString() { + return "NRCellDUModel [cellLocalId=" + cellLocalId + ", operationalState=" + operationalState + + ", administrativeState=" + administrativeState + ", cellState=" + cellState + ", pLMNInfoList=" + + pLMNInfoList + ", nRPCI=" + nRPCI + ", nRTAC=" + nRTAC + ", resourceType=" + resourceType + ", prbs=" + + prbs + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIConfigData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIConfigData.java new file mode 100644 index 0000000..c49d1c8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIConfigData.java @@ -0,0 +1,66 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +public class NSSAIConfigData { + private Integer dLThptPerSlice; + private Integer uLThptPerSlice; + private Integer maxNumberOfConns; + private String lastUpdatedTS; + + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + + public Integer getMaxNumberOfConns() { + return maxNumberOfConns; + } + + public void setMaxNumberOfConns(Integer maxNumberOfConns) { + this.maxNumberOfConns = maxNumberOfConns; + } + + public String getLastUpdatedTS() { + return lastUpdatedTS; + } + + public void setLastUpdatedTS(String lastUpdatedTS) { + this.lastUpdatedTS = lastUpdatedTS; + } + + @Override + public String toString() { + return "NSSAIConfigData [dLThptPerSlice=" + dLThptPerSlice + ", uLThptPerSlice=" + uLThptPerSlice + + ", maxNumberOfConns=" + maxNumberOfConns + ", lastUpdatedTS=" + lastUpdatedTS + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIData.java new file mode 100644 index 0000000..d114a08 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NSSAIData.java @@ -0,0 +1,72 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import org.onap.ransim.rest.api.models.NSSAIConfig; + +public class NSSAIData { + private String sNSSAI; + private String status; + private String globalSubscriberId; + private String subscriptionServiceType; + // private Map<String, Integer> configData; + private NSSAIConfig configData; + + public String getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public NSSAIConfig getConfigData() { + return configData; + } + + public void setConfigData(NSSAIConfig configData) { + this.configData = configData; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetwork.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetwork.java new file mode 100644 index 0000000..995c503 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetwork.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class NbrCellsNetwork { + // param + + private String targetCellId; + private long pciValue; + private boolean ho; + + public String getTargetCellId() { + return targetCellId; + } + + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + + public long getPciValue() { + return pciValue; + } + + public void setPciValue(long pciValue) { + this.pciValue = pciValue; + } + + public boolean isHo() { + return ho; + } + + public void setHo(boolean ho) { + this.ho = ho; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetworkResponse.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetworkResponse.java new file mode 100644 index 0000000..00dc861 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrCellsNetworkResponse.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class NbrCellsNetworkResponse { + + private String networkId; + // private List<NbrCellsNetwork> NbrCellsNetworkObjList; + @JsonProperty("cellsNbrList") + private List<NbrListResponse> cellsNbrList; + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public List<NbrListResponse> getCellsNbrList() { + return cellsNbrList; + } + + public void setCellsNbrList(List<NbrListResponse> cellsNbrList) { + this.cellsNbrList = cellsNbrList; + } + + /* + * public List<NbrCellsNetwork> getNbrCellsNetworkObjList() { + * return NbrCellsNetworkObjList; + * } + * public void setNbrCellsNetworkObjList(List<NbrCellsNetwork> nbrCellsNetworkObjList) { + * NbrCellsNetworkObjList = nbrCellsNetworkObjList; + * } + */ + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrList.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrList.java new file mode 100644 index 0000000..ee0f786 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrList.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class NbrList { + // param + + private String targetCellId; + private long pciValue; + private boolean ho; + + public String getTargetCellId() { + return targetCellId; + } + + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + + public long getPciValue() { + return pciValue; + } + + public void setPciValue(long pciValue) { + this.pciValue = pciValue; + } + + public boolean isHo() { + return ho; + } + + public void setHo(boolean ho) { + this.ho = ho; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrListResponse.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrListResponse.java new file mode 100644 index 0000000..6d7448a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrListResponse.java @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +/** + * + * Response Mapper class for NbrList + * + */ +public class NbrListResponse { + + private String cellId; + private List<NbrList> nbrList; + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public List<NbrList> getNbrList() { + return nbrList; + } + + public void setNbrList(List<NbrList> nbrList) { + this.nbrList = nbrList; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrObj.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrObj.java new file mode 100644 index 0000000..df15cf8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NbrObj.java @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +public class NbrObj { + private String targetCellId; + private boolean ho; + + public String getTargetCellId() { + return targetCellId; + } + + public void setTargetCellId(String targetCellId) { + this.targetCellId = targetCellId; + } + + public boolean isHo() { + return ho; + } + + public void setHo(boolean ho) { + this.ho = ho; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NearRTRICModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NearRTRICModel.java new file mode 100644 index 0000000..c29abda --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/NearRTRICModel.java @@ -0,0 +1,115 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class NearRTRICModel { + private Integer nearRTRICId; + private Integer gNBId; + private List<String> trackingArea; + private String resourceType; + private List<GNBCUCPModel> gNBCUCPList; + private List<GNBCUUPModel> gNBCUUPList; + private List<GNBDUModel> gNBDUList; + private List<String> ranNFNSSIList; + private List<PLMNInfoModel> pLMNInfoList; + + public Integer getNearRTRICId() { + return nearRTRICId; + } + + public void setNearRTRICId(Integer nearRTRICId) { + this.nearRTRICId = nearRTRICId; + } + + public Integer getgNBId() { + return gNBId; + } + + public void setgNBId(Integer gNBId) { + this.gNBId = gNBId; + } + + public List<String> getTrackingArea() { + return trackingArea; + } + + public void setTrackingArea(List<String> trackingArea) { + this.trackingArea = trackingArea; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public List<String> getRanNFNSSIList() { + return ranNFNSSIList; + } + + public void setRanNFNSSIList(List<String> ranNFNSSIList) { + this.ranNFNSSIList = ranNFNSSIList; + } + + public List<GNBCUCPModel> getgNBCUCPList() { + return gNBCUCPList; + } + + public void setgNBCUCPList(List<GNBCUCPModel> gNBCUCPList) { + this.gNBCUCPList = gNBCUCPList; + } + + public List<GNBCUUPModel> getgNBCUUPList() { + return gNBCUUPList; + } + + public void setgNBCUUPList(List<GNBCUUPModel> gNBCUUPList) { + this.gNBCUUPList = gNBCUUPList; + } + + public List<GNBDUModel> getgNBDUList() { + return gNBDUList; + } + + public void setgNBDUList(List<GNBDUModel> gNBDUList) { + this.gNBDUList = gNBDUList; + } + + public List<PLMNInfoModel> getpLMNInfoList() { + return pLMNInfoList; + } + + public void setpLMNInfoList(List<PLMNInfoModel> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } + + @Override + public String toString() { + return "NearRTRICModel [nearRTRICId=" + nearRTRICId + ", gNBId=" + gNBId + ", trackingArea=" + trackingArea + + ", resourceType=" + resourceType + ", gNBCUCPList=" + gNBCUCPList + ", gNBCUUPList=" + gNBCUUPList + + ", gNBDUList=" + gNBDUList + ", ranNFNSSIList=" + ranNFNSSIList + ", pLMNInfoList=" + pLMNInfoList + + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/PLMNInfoModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/PLMNInfoModel.java new file mode 100644 index 0000000..3bddf1a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/PLMNInfoModel.java @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +public class PLMNInfoModel { + private String pLMNId; + private NSSAIData sNSSAI; + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public NSSAIData getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(NSSAIData sNSSAI) { + this.sNSSAI = sNSSAI; + } + + @Override + public String toString() { + return "PLMNInfoModel [pLMNId=" + pLMNId + ", sNSSAI=" + sNSSAI + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RANSliceInfoModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RANSliceInfoModel.java new file mode 100644 index 0000000..610309b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RANSliceInfoModel.java @@ -0,0 +1,118 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.io.Serializable; +import java.util.List; + +public class RANSliceInfoModel implements Serializable { + private static final long serialVersionUID = 1L; + private String ranNFNSSIId; + private List<String> ranNSSIList; + private List<String> nSSAIList; + private List<SliceProfileModel> sliceProfilesList; + private String trackingAreaList; + private String subnetStatus; + private String nsstId; + private String sliceType; + private String isShareable; + + public String getRanNFNSSIId() { + return ranNFNSSIId; + } + + public void setRanNFNSSIId(String ranNFNSSIId) { + this.ranNFNSSIId = ranNFNSSIId; + } + + public List<String> getRanNSSIList() { + return ranNSSIList; + } + + public void setRanNSSIList(List<String> ranNSSIList) { + this.ranNSSIList = ranNSSIList; + } + + public String getTrackingAreaList() { + return trackingAreaList; + } + + public void setTrackingAreaList(String trackingAreaList) { + this.trackingAreaList = trackingAreaList; + } + + public String getSubnetStatus() { + return subnetStatus; + } + + public void setSubnetStatus(String subnetStatus) { + this.subnetStatus = subnetStatus; + } + + public String getNsstId() { + return nsstId; + } + + public void setNsstId(String nsstId) { + this.nsstId = nsstId; + } + + public String getSliceType() { + return sliceType; + } + + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + + public String getIsShareable() { + return isShareable; + } + + public List<String> getnSSAIList() { + return nSSAIList; + } + + public void setnSSAIList(List<String> nSSAIList) { + this.nSSAIList = nSSAIList; + } + + public List<SliceProfileModel> getSliceProfilesList() { + return sliceProfilesList; + } + + public void setSliceProfilesList(List<SliceProfileModel> sliceProfilesList) { + this.sliceProfilesList = sliceProfilesList; + } + + public void setIsShareable(String isShareable) { + this.isShareable = isShareable; + } + + @Override + public String toString() { + return "RANSliceInfoModel [ranNFNSSIId=" + ranNFNSSIId + ", ranNSSIList=" + ranNSSIList + ", nSSAIList=" + + nSSAIList + ", sliceProfilesList=" + sliceProfilesList + ", trackingAreaList=" + trackingAreaList + + ", subnetStatus=" + subnetStatus + ", nsstId=" + nsstId + ", sliceType=" + sliceType + + ", isShareable=" + isShareable + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyMemberModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyMemberModel.java new file mode 100644 index 0000000..df9ccfa --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyMemberModel.java @@ -0,0 +1,47 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +public class RRMPolicyMemberModel { + private String pLMNId; + private NSSAIData sNSSAI; + + public String getpLMNId() { + return pLMNId; + } + + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } + + public NSSAIData getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(NSSAIData sNSSAI) { + this.sNSSAI = sNSSAI; + } + + @Override + public String toString() { + return "RRMPolicyMemberModel [pLMNId=" + pLMNId + ", sNSSAI=" + sNSSAI + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyRatioModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyRatioModel.java new file mode 100644 index 0000000..9c89b5e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/RRMPolicyRatioModel.java @@ -0,0 +1,116 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class RRMPolicyRatioModel { + private Integer rrmPolicyID; + private String resourceID; + private String resourceType; + private String sliceType; + private List<RRMPolicyMemberModel> rRMPolicyMemberList; + private String quotaType; + private Integer rRMPolicyMaxRatio; + private Integer rRMPolicyMinRatio; + private Integer rRMPolicyDedicatedRatio; + + public Integer getRrmPolicyID() { + return rrmPolicyID; + } + + public void setRrmPolicyID(Integer rrmPolicyID) { + this.rrmPolicyID = rrmPolicyID; + } + + public String getResourceID() { + return resourceID; + } + + public void setResourceID(String resourceID) { + this.resourceID = resourceID; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public String getSliceType() { + return sliceType; + } + + public void setSliceType(String sliceType) { + this.sliceType = sliceType; + } + + public List<RRMPolicyMemberModel> getrRMPolicyMemberList() { + return rRMPolicyMemberList; + } + + public void setrRMPolicyMemberList(List<RRMPolicyMemberModel> rRMPolicyMemberList) { + this.rRMPolicyMemberList = rRMPolicyMemberList; + } + + public String getQuotaType() { + return quotaType; + } + + public void setQuotaType(String quotaType) { + this.quotaType = quotaType; + } + + public Integer getrRMPolicyMaxRatio() { + return rRMPolicyMaxRatio; + } + + public void setrRMPolicyMaxRatio(Integer rRMPolicyMaxRatio) { + this.rRMPolicyMaxRatio = rRMPolicyMaxRatio; + } + + public Integer getrRMPolicyMinRatio() { + return rRMPolicyMinRatio; + } + + public void setrRMPolicyMinRatio(Integer rRMPolicyMinRatio) { + this.rRMPolicyMinRatio = rRMPolicyMinRatio; + } + + public Integer getrRMPolicyDedicatedRatio() { + return rRMPolicyDedicatedRatio; + } + + public void setrRMPolicyDedicatedRatio(Integer rRMPolicyDedicatedRatio) { + this.rRMPolicyDedicatedRatio = rRMPolicyDedicatedRatio; + } + + @Override + public String toString() { + return "RRMPolicyRatioModel [rrmPolicyID=" + rrmPolicyID + ", resourceID=" + resourceID + ", resourceType=" + + resourceType + ", sliceType=" + sliceType + ", rRMPolicyMemberList=" + rRMPolicyMemberList + + ", quotaType=" + quotaType + ", rRMPolicyMaxRatio=" + rRMPolicyMaxRatio + ", rRMPolicyMinRatio=" + + rRMPolicyMinRatio + ", rRMPolicyDedicatedRatio=" + rRMPolicyDedicatedRatio + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/Result.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/Result.java new file mode 100644 index 0000000..8b0ba3c --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/Result.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Mapper Class for Result + * + */ +public class Result { + // param + @JsonProperty("attribute-name") + private String attributeName; + @JsonProperty("value") + private String value; + + public Result(String atributeName, String value) { + super(); + this.attributeName = atributeName; + this.value = value; + } + + public String getAttributeName() { + return attributeName; + } + + public void setAttributeName(String attributeName) { + this.attributeName = attributeName; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/SliceProfileModel.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/SliceProfileModel.java new file mode 100644 index 0000000..c7be576 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/web/mapper/SliceProfileModel.java @@ -0,0 +1,134 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.web.mapper; + +import java.util.List; + +public class SliceProfileModel { + private String sliceProfileId; + private String sNSSAI; + private String pLMNIdList; + private Integer maxNumberofUEs; + private Integer latency; + private Integer dLThptPerSlice; + private Integer uLThptPerSlice; + private Integer maxNumberofConns; + private String uEMobilityLevel; + private String resourceSharingLevel; + private List<String> coverageAreaList; + + public String getSliceProfileId() { + return sliceProfileId; + } + + public void setSliceProfileId(String sliceProfileId) { + this.sliceProfileId = sliceProfileId; + } + + public String getsNSSAI() { + return sNSSAI; + } + + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } + + public String getpLMNIdList() { + return pLMNIdList; + } + + public void setpLMNIdList(String pLMNIdList) { + this.pLMNIdList = pLMNIdList; + } + + public Integer getMaxNumberofUEs() { + return maxNumberofUEs; + } + + public void setMaxNumberofUEs(Integer maxNumberofUEs) { + this.maxNumberofUEs = maxNumberofUEs; + } + + public Integer getLatency() { + return latency; + } + + public void setLatency(Integer latency) { + this.latency = latency; + } + + public Integer getdLThptPerSlice() { + return dLThptPerSlice; + } + + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } + + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } + + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } + + public Integer getMaxNumberofConns() { + return maxNumberofConns; + } + + public void setMaxNumberofConns(Integer maxNumberofConns) { + this.maxNumberofConns = maxNumberofConns; + } + + public String getuEMobilityLevel() { + return uEMobilityLevel; + } + + public void setuEMobilityLevel(String uEMobilityLevel) { + this.uEMobilityLevel = uEMobilityLevel; + } + + public String getResourceSharingLevel() { + return resourceSharingLevel; + } + + public void setResourceSharingLevel(String resourceSharingLevel) { + this.resourceSharingLevel = resourceSharingLevel; + } + + public List<String> getCoverageAreaList() { + return coverageAreaList; + } + + public void setCoverageAreaList(List<String> coverageAreaList) { + this.coverageAreaList = coverageAreaList; + } + + @Override + public String toString() { + return "SliceProfileModel [sliceProfileId=" + sliceProfileId + ", sNSSAI=" + sNSSAI + ", pLMNIdList=" + + pLMNIdList + ", maxNumberofUEs=" + maxNumberofUEs + ", latency=" + latency + ", dLThptPerSlice=" + + dLThptPerSlice + ", uLThptPerSlice=" + uLThptPerSlice + ", maxNumberofConns=" + maxNumberofConns + + ", uEMobilityLevel=" + uEMobilityLevel + ", resourceSharingLevel=" + resourceSharingLevel + + ", coverageAreaList=" + coverageAreaList + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileFooter.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileFooter.java new file mode 100644 index 0000000..97abfbb --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileFooter.java @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class FileFooter { + private MeasCollecEnd measCollec; + + public FileFooter() { + + } + + public FileFooter(MeasCollecEnd measCollec) { + super(); + this.measCollec = measCollec; + } + + public MeasCollecEnd getMeasCollec() { + return measCollec; + } + + public void setMeasCollec(MeasCollecEnd measCollec) { + this.measCollec = measCollec; + } + + @Override + public String toString() { + return "FileFooter [measCollec=" + measCollec + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileHeader.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileHeader.java new file mode 100644 index 0000000..ef8634f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileHeader.java @@ -0,0 +1,96 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class FileHeader { + private String dnPrefix; + private String vendorName; + private String fileFormatVersion; + private MeasCollec measCollec; + private FileSender fileSender; + + public FileHeader() { + + } + + public FileHeader(String dnPrefix, String vendorName, String fileFormatVersion, MeasCollec measCollec, + FileSender fileSender) { + super(); + this.dnPrefix = dnPrefix; + this.vendorName = vendorName; + this.fileFormatVersion = fileFormatVersion; + this.measCollec = measCollec; + this.fileSender = fileSender; + } + + public MeasCollec getMeasCollec() { + return measCollec; + } + + public void setMeasCollec(MeasCollec measCollec) { + this.measCollec = measCollec; + } + + @XmlAttribute + public String getDnPrefix() { + return dnPrefix; + } + + public void setDnPrefix(String dnPrefix) { + this.dnPrefix = dnPrefix; + } + + @XmlAttribute + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + @XmlAttribute + public String getFileFormatVersion() { + return fileFormatVersion; + } + + public void setFileFormatVersion(String fileFormatVersion) { + this.fileFormatVersion = fileFormatVersion; + } + + public FileSender getFileSender() { + return fileSender; + } + + public void setFileSender(FileSender fileSender) { + this.fileSender = fileSender; + } + + @Override + public String toString() { + return "FileHeader [dnPrefix=" + dnPrefix + ", vendorName=" + vendorName + ", fileFormatVersion=" + + fileFormatVersion + ", measCollec=" + measCollec + ", fileSender=" + fileSender + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileSender.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileSender.java new file mode 100644 index 0000000..f5f4fad --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/FileSender.java @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class FileSender { + private String localDn; + + // private String elementType; + public FileSender() { + + } + + public FileSender(String localDn) { + super(); + this.localDn = localDn; + } + + @XmlAttribute + public String getLocalDn() { + return localDn; + } + + public void setLocalDn(String localDn) { + this.localDn = localDn; + } + + /* + * @XmlAttribute public String getElementType() { return elementType; } public + * void setElementType(String elementType) { this.elementType = elementType; } + */ + @Override + public String toString() { + return "FileSender [localDn=" + localDn + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/GranularityPeriod.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/GranularityPeriod.java new file mode 100644 index 0000000..ec18cf3 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/GranularityPeriod.java @@ -0,0 +1,63 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class GranularityPeriod { + private String endTime; + private String duration; + + public GranularityPeriod() { + + } + + public GranularityPeriod(String endTime, String duration) { + super(); + this.endTime = endTime; + this.duration = duration; + } + + @XmlAttribute + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + @XmlAttribute + public String getDuration() { + return duration; + } + + public void setDuration(String duration) { + this.duration = duration; + } + + @Override + public String toString() { + return "GranularityPeriod [endTime=" + endTime + ", duration=" + duration + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Job.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Job.java new file mode 100644 index 0000000..1f1bfd8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Job.java @@ -0,0 +1,53 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class Job { + private String jobId; + + public Job() { + + } + + public Job(String jobId) { + super(); + this.jobId = jobId; + } + + @XmlAttribute + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + @Override + public String toString() { + return "Job [jobId=" + jobId + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ManagedElement.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ManagedElement.java new file mode 100644 index 0000000..fe43701 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ManagedElement.java @@ -0,0 +1,70 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class ManagedElement { + private String swVersion; + private String localDn; + // private String userLabel; + + public ManagedElement() { + + } + + public ManagedElement(String swVersion, String localDn) { + super(); + this.swVersion = swVersion; + this.localDn = localDn; + // this.userLabel = userLabel; + } + + @XmlAttribute + public String getSwVersion() { + return swVersion; + } + + public void setSwVersion(String swVersion) { + this.swVersion = swVersion; + } + + @XmlAttribute + public String getLocalDn() { + return localDn; + } + + public void setLocalDn(String localDn) { + this.localDn = localDn; + } + + /* + * @XmlAttribute public String getUserLabel() { return userLabel; } public void + * setUserLabel(String userLabel) { this.userLabel = userLabel; } + */ + @Override + public String toString() { + return "ManagedElement [swVersion=" + swVersion + ", localDn=" + localDn + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollec.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollec.java new file mode 100644 index 0000000..5052536 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollec.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasCollec { + private String beginTime; + + public MeasCollec() { + + } + + public MeasCollec(String beginTime) { + super(); + this.beginTime = beginTime; + } + + @XmlAttribute + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + @Override + public String toString() { + return "MeasCollec [beginTime=" + beginTime + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecEnd.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecEnd.java new file mode 100644 index 0000000..534eaae --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecEnd.java @@ -0,0 +1,39 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasCollecEnd { + @XmlAttribute + private String endTime; + + public MeasCollecEnd() { + + } + + public MeasCollecEnd(String endTime) { + super(); + this.endTime = endTime; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecFile.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecFile.java new file mode 100644 index 0000000..bfc5c31 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasCollecFile.java @@ -0,0 +1,75 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasCollecFile { + @XmlAttribute + private String xmlns; + @XmlElement + private FileHeader fileHeader; + @XmlElement + private List<MeasData> measData; + @XmlElement + private FileFooter fileFooter; + + public MeasCollecFile() { + + } + + public MeasCollecFile(FileHeader fileHeader, List<MeasData> measData, FileFooter fileFooter, String xmlns) { + super(); + this.fileHeader = fileHeader; + this.measData = measData; + this.fileFooter = fileFooter; + this.xmlns = xmlns; + } + + // public FileHeader getFileHeader() { + // return fileHeader; + // } + // public void setFileHeader(FileHeader fileHeader) { + // this.fileHeader = fileHeader; + // } + // public List<MeasData> getMeasData() { + // return measData; + // } + // public void setMeasData(List<MeasData> measData) { + // this.measData = measData; + // } + // public FileFooter getFileFooter() { + // return fileFooter; + // } + // public void setFileFooter(FileFooter fileFooter) { + // this.fileFooter = fileFooter; + // } + @Override + public String toString() { + return "MeasCollecFile [fileHeader=" + fileHeader + ", measData=" + measData + ", fileFooter=" + fileFooter + + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasData.java new file mode 100644 index 0000000..e57a010 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasData.java @@ -0,0 +1,63 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasData { + private ManagedElement managedElement; + private List<MeasInfo> measInfo; + + public MeasData() { + } + + public MeasData(ManagedElement managedElement, List<MeasInfo> measInfo) { + super(); + this.managedElement = managedElement; + this.measInfo = measInfo; + } + + public ManagedElement getManagedElement() { + return managedElement; + } + + public void setManagedElement(ManagedElement managedElement) { + this.managedElement = managedElement; + } + + public List<MeasInfo> getMeasInfo() { + return measInfo; + } + + public void setMeasInfo(List<MeasInfo> measInfo) { + this.measInfo = measInfo; + } + + @Override + public String toString() { + return "MeasData [managedElement=" + managedElement + ", measInfo=" + measInfo + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasInfo.java new file mode 100644 index 0000000..54da288 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasInfo.java @@ -0,0 +1,107 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement +@XmlType(propOrder = {"measInfoId", "job", "granPeriod", "repPeriod", "measType", "measValue"}) +public class MeasInfo { + private String measInfoId; + private Job job; + private GranularityPeriod granPeriod; + private ReportingPeriod repPeriod; + private List<MeasType> measType; + private List<MeasValue> measValue; + + public MeasInfo(String measInfoId, Job job, GranularityPeriod granPeriod, ReportingPeriod repPeriod, + List<MeasType> measType, List<MeasValue> measValue) { + super(); + this.measInfoId = measInfoId; + this.job = job; + this.granPeriod = granPeriod; + this.repPeriod = repPeriod; + this.measType = measType; + this.measValue = measValue; + } + + public MeasInfo() { + } + + @XmlAttribute + public String getMeasInfoId() { + return measInfoId; + } + + public void setMeasInfoId(String measInfoId) { + this.measInfoId = measInfoId; + } + + public Job getJob() { + return job; + } + + public void setJob(Job job) { + this.job = job; + } + + public GranularityPeriod getGranPeriod() { + return granPeriod; + } + + public void setGranPeriod(GranularityPeriod granPeriod) { + this.granPeriod = granPeriod; + } + + public ReportingPeriod getRepPeriod() { + return repPeriod; + } + + public void setRepPeriod(ReportingPeriod repPeriod) { + this.repPeriod = repPeriod; + } + + public List<MeasType> getMeasType() { + return measType; + } + + public void setMeasType(List<MeasType> measType) { + this.measType = measType; + } + + public List<MeasValue> getMeasValue() { + return measValue; + } + + public void setMeasValue(List<MeasValue> measValue) { + this.measValue = measValue; + } + + @Override + public String toString() { + return "MeasInfo [measInfoId=" + measInfoId + ", job=" + job + ", granPeriod=" + granPeriod + ", repPeriod=" + + repPeriod + ", measType=" + measType + ", measValue=" + measValue + "]"; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasResult.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasResult.java new file mode 100644 index 0000000..c3983c1 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasResult.java @@ -0,0 +1,38 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import java.util.List; + +public class MeasResult { + private String position; + private String result; + + public MeasResult(String position, String result) { + super(); + this.position = position; + this.result = result; + } + + public MeasResult() { + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasType.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasType.java new file mode 100644 index 0000000..94f8826 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasType.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; + +@XmlRootElement +public class MeasType { + + private String measType; + private int p; + + public MeasType(String measType, int p) { + super(); + this.measType = measType; + this.p = p; + } + + public MeasType() { + } + + @XmlValue + public String getMeasType() { + return measType; + } + + public void setMeasType(String measType) { + this.measType = measType; + } + + @XmlAttribute + public int getP() { + return p; + } + + public void setP(int p) { + this.p = p; + } + + @Override + public String toString() { + return "MeasType [measType=" + measType + ", p=" + p + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasValue.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasValue.java new file mode 100644 index 0000000..3530dd9 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/MeasValue.java @@ -0,0 +1,76 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class MeasValue { + private Integer measObjLdn; + private List<Result> r; + + public MeasValue() { + + } + + public MeasValue(Integer measObjLdn, List<Result> r, boolean suspect) { + super(); + this.measObjLdn = measObjLdn; + this.r = r; + this.suspect = suspect; + } + + private boolean suspect; + + @XmlAttribute + public Integer getMeasObjLdn() { + return measObjLdn; + } + + public void setMeasObjLdn(Integer measObjLdn) { + this.measObjLdn = measObjLdn; + } + + public List<Result> getR() { + return r; + } + + public void setR(List<Result> r) { + this.r = r; + } + + public boolean isSuspect() { + return suspect; + } + + public void setSuspect(boolean suspect) { + this.suspect = suspect; + } + + @Override + public String toString() { + return "MeasValue [measObjLdn=" + measObjLdn + ", r=" + r + ", suspect=" + suspect + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ReportingPeriod.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ReportingPeriod.java new file mode 100644 index 0000000..aec88e3 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/ReportingPeriod.java @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; + +public class ReportingPeriod { + @XmlAttribute + public String getDuration() { + return duration; + } + + public void setDuration(String duration) { + this.duration = duration; + } + + private String duration; + + public ReportingPeriod() { + } + + public ReportingPeriod(String duration) { + super(); + this.duration = duration; + } + + @Override + public String toString() { + return "ReportingPeriod [duration=" + duration + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Result.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Result.java new file mode 100644 index 0000000..cbaf121 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/xml/models/Result.java @@ -0,0 +1,64 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.xml.models; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; + +@XmlRootElement +public class Result { + private int p; + private int measValue; + + public Result() { + } + + public Result(int p, int measValue) { + super(); + this.p = p; + this.measValue = measValue; + } + + @XmlAttribute + public int getP() { + return p; + } + + public void setP(int p) { + this.p = p; + } + + @XmlValue + public double getMeasValue() { + return measValue; + } + + public void setMeasValue(int measValue) { + this.measValue = measValue; + } + + @Override + public String toString() { + return "Result [p=" + p + ", measValue=" + measValue + "]"; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/utilities/RansimUtilities.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/utilities/RansimUtilities.java new file mode 100644 index 0000000..48804e6 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/utilities/RansimUtilities.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.utilities; + +/** + * + * Class with Utilities used across ransim + */ +public class RansimUtilities { + + /** + * @param angle + * @return + */ + public static double degToRadians(double angle) { + double radians = 57.2957795; + return (angle / radians); + } + + /** + * @param angle + * @return + */ + public static double metersDeglon(double angle) { + double d2r = degToRadians(angle); + return ((111415.13 * Math.cos(d2r)) - (94.55 * Math.cos(3.0 * d2r)) + (0.12 * Math.cos(5.0 * d2r))); + } + + /** + * @param angle + * @return + */ + public static double metersDeglat(double angle) { + double d2r = degToRadians(angle); + return (111132.09 - (566.05 * Math.cos(2.0 * d2r)) + (1.20 * Math.cos(4.0 * d2r)) + - (0.002 * Math.cos(6.0 * d2r))); + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java index 650bfa8..ba6c453 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java @@ -20,20 +20,18 @@ package org.onap.ransim.websocket.model; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; public class AdditionalMeasurements { - + private String name; private Map<String, String> hashMap = new HashMap<String, String>(); - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } @@ -45,6 +43,5 @@ public class AdditionalMeasurements { public void setHashMap(Map<String, String> hashMap) { this.hashMap = hashMap; } - - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Attributes.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Attributes.java new file mode 100644 index 0000000..686ba37 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Attributes.java @@ -0,0 +1,74 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Attributes { + + private String locationName; + private String gNBId; + private String operationalState; + private String cellState; + private String gNBCUUPId; + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getgNBId() { + return gNBId; + } + + public void setgNBId(String gNBId) { + this.gNBId = gNBId; + } + + public String getOperationalState() { + return operationalState; + } + + public void setOperationalState(String operationalState) { + this.operationalState = operationalState; + } + + public String getCellState() { + return cellState; + } + + public void setCellState(String cellState) { + this.cellState = cellState; + } + + public String getgNBCUUPId() { + return gNBCUUPId; + } + + public void setgNBCUUPId(String gNBCUUPId) { + this.gNBCUUPId = gNBCUUPId; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java index aa75009..c0afa18 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java @@ -21,18 +21,18 @@ package org.onap.ransim.websocket.model; public class CommonEventHeaderFm { - + private String sourceName; private String sourceUuid; private String reportingEntityName; private long startEpochMicrosec; private long lastEpochMicrosec; - + public CommonEventHeaderFm() { super(); // TODO Auto-generated constructor stub } - + public CommonEventHeaderFm(String sourceName, String sourceUuid, String reportingEntityName, long startEpochMicrosec, long lastEpochMicrosec) { super(); @@ -42,45 +42,45 @@ public class CommonEventHeaderFm { this.startEpochMicrosec = startEpochMicrosec; this.lastEpochMicrosec = lastEpochMicrosec; } - + public String getSourceName() { return sourceName; } - + public void setSourceName(String sourceName) { this.sourceName = sourceName; } - + public String getSourceUuid() { return sourceUuid; } - + public void setSourceUuid(String sourceUuid) { this.sourceUuid = sourceUuid; } - + public long getStartEpochMicrosec() { return startEpochMicrosec; } - + public void setStartEpochMicrosec(long startEpochMicrosec) { this.startEpochMicrosec = startEpochMicrosec; } - + public long getLastEpochMicrosec() { return lastEpochMicrosec; } - + public void setLastEpochMicrosec(long lastEpochMicrosec) { this.lastEpochMicrosec = lastEpochMicrosec; } - + public String getReportingEntityName() { return reportingEntityName; } - + public void setReportingEntityName(String reportingEntityName) { this.reportingEntityName = reportingEntityName; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java index 9f87529..e31a62c 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java @@ -21,7 +21,7 @@ package org.onap.ransim.websocket.model; public class CommonEventHeaderPm { - + private String sourceName; private String sourceUuid; private long startEpochMicrosec; @@ -30,7 +30,7 @@ public class CommonEventHeaderPm { public String getSourceName() { return sourceName; } - + public void setSourceName(String sourceName) { this.sourceName = sourceName; } @@ -46,17 +46,17 @@ public class CommonEventHeaderPm { public long getStartEpochMicrosec() { return startEpochMicrosec; } - + public void setStartEpochMicrosec(long startEpochMicrosec) { this.startEpochMicrosec = startEpochMicrosec; } - + public long getLastEpochMicrosec() { return lastEpochMicrosec; } - + public void setLastEpochMicrosec(long lastEpochMicrosec) { this.lastEpochMicrosec = lastEpochMicrosec; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigData.java new file mode 100644 index 0000000..a3770d5 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigData.java @@ -0,0 +1,53 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +public class ConfigData { + + private String configParameter; + + private int configValue; + + public String getConfigParameter() { + return configParameter; + } + + public void setConfigParameter(String configParameter) { + this.configParameter = configParameter; + } + + public int getConfigValue() { + return configValue; + } + + public void setConfigValue(int configValue) { + this.configValue = configValue; + } + + public ConfigData() { + + } + + public ConfigData(String configParameter, int configValue) { + this.configParameter = configParameter; + this.configValue = configValue; + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigPLMNInfo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigPLMNInfo.java new file mode 100644 index 0000000..7f8eba2 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ConfigPLMNInfo.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import java.util.*; + +public class ConfigPLMNInfo { + + private String mcc; + private String mnc; + private List<SNSSAI> sNSSAI; + + public String getMcc() { + return mcc; + } + + public void setMcc(String mcc) { + this.mcc = mcc; + } + + public String getMnc() { + return mnc; + } + + public void setMnc(String mnc) { + this.mnc = mnc; + } + + public List<SNSSAI> getSNSSAI() { + return sNSSAI; + } + + public void setSNSSAI(List<SNSSAI> sNSSAI) { + this.sNSSAI = sNSSAI; + } + + public ConfigPLMNInfo() { + + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java index 5954408..e5059b2 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java @@ -23,25 +23,25 @@ package org.onap.ransim.websocket.model; import java.io.Serializable; public class DeviceData implements Serializable { - + private static final long serialVersionUID = 4388248209444904611L; - + private String type; private String message; - + public void setType(String type) { this.type = type; } - + public String getType() { return type; } - + public void setMessage(String message) { this.message = message; } - + public String getMessage() { return message; } -}
\ No newline at end of file +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java index caddc59..f1aac74 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java @@ -25,16 +25,15 @@ import javax.websocket.Decoder; import javax.websocket.EndpointConfig; public class DeviceDataDecoder implements Decoder.Text<DeviceData> { - - // public class DeviceDataDecoder implements Decoder.Text<DeviceData> + @Override public void destroy() { } - + @Override public void init(EndpointConfig arg0) { } - + @Override public DeviceData decode(String msgInfo) throws DecodeException { DeviceData data = new DeviceData(); @@ -47,11 +46,10 @@ public class DeviceDataDecoder implements Decoder.Text<DeviceData> { data.setType(strInfo[0]); return data; } - + @Override public boolean willDecode(String arg0) { - // TODO Auto-generated method stub return true; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java index 6c29929..21f60fa 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java @@ -25,23 +25,23 @@ import javax.websocket.Encoder; import javax.websocket.EndpointConfig; public class DeviceDataEncoder implements Encoder.Text<DeviceData> { - + @Override public void destroy() { // TODO Auto-generated method stub - + } - + @Override public void init(EndpointConfig arg0) { // TODO Auto-generated method stub - + } - + @Override public String encode(DeviceData msg) throws EncodeException { String result = msg.getType() + ":" + msg.getMessage(); return result; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java index ec340f5..e4818c7 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java @@ -21,35 +21,35 @@ package org.onap.ransim.websocket.model; public class EventFm { - + private CommonEventHeaderFm commonEventHeader; private FaultFields faultFields; - + public EventFm(CommonEventHeaderFm commonEventHeader, FaultFields faultFields) { super(); this.commonEventHeader = commonEventHeader; this.faultFields = faultFields; } - + public EventFm() { super(); // TODO Auto-generated constructor stub } - + public CommonEventHeaderFm getCommonEventHeader() { return commonEventHeader; } - + public void setCommonEventHeader(CommonEventHeaderFm commonEventHeader) { this.commonEventHeader = commonEventHeader; } - + public FaultFields getFaultFields() { return faultFields; } - + public void setFaultFields(FaultFields faultFields) { this.faultFields = faultFields; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java index f6dbb63..5fcee4d 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java @@ -21,24 +21,24 @@ package org.onap.ransim.websocket.model; public class EventPm { - + private CommonEventHeaderPm commonEventHeader; private Measurement measurement; - + public CommonEventHeaderPm getCommonEventHeader() { return commonEventHeader; } - + public void setCommonEventHeader(CommonEventHeaderPm commonEventHeader) { this.commonEventHeader = commonEventHeader; } - + public Measurement getMeasurement() { return measurement; } - + public void setMeasurement(Measurement measurement) { this.measurement = measurement; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java index ebf31f7..17fed3c 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java @@ -23,20 +23,19 @@ package org.onap.ransim.websocket.model; import java.util.Map; public class FaultFields { - + private String alarmCondition; private String eventSourceType; private String specificProblem; private String eventSeverity; private Map<String, String> alarmAdditionalInformation; - + public FaultFields() { super(); - // TODO Auto-generated constructor stub } - - public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, - String eventSeverity, Map<String, String> alarmAdditionalInformation) { + + public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, String eventSeverity, + Map<String, String> alarmAdditionalInformation) { super(); this.alarmCondition = alarmCondition; this.eventSourceType = eventSourceType; @@ -44,45 +43,45 @@ public class FaultFields { this.eventSeverity = eventSeverity; this.alarmAdditionalInformation = alarmAdditionalInformation; } - + public String getAlarmCondition() { return alarmCondition; } - + public void setAlarmCondition(String alarmCondition) { this.alarmCondition = alarmCondition; } - + public String getEventSourceType() { return eventSourceType; } - + public void setEventSourceType(String eventSourceType) { this.eventSourceType = eventSourceType; } - + public String getSpecificProblem() { return specificProblem; } - + public void setSpecificProblem(String specificProblem) { this.specificProblem = specificProblem; } - + public String getEventSeverity() { return eventSeverity; } - + public void setEventSeverity(String eventSeverity) { this.eventSeverity = eventSeverity; } - + public Map<String, String> getAlarmAdditionalInformation() { return alarmAdditionalInformation; } - + public void setAlarmAdditionalInformation(Map<String, String> alarmAdditionalInformation) { this.alarmAdditionalInformation = alarmAdditionalInformation; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java index c11ab64..3c46d46 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java @@ -25,7 +25,7 @@ import java.util.List; public class FmMessage { List<EventFm> fmEventList; - + public void setFmEventList(List<EventFm> data) { this.fmEventList = data; } @@ -33,5 +33,5 @@ public class FmMessage { public List<EventFm> getFmEventList() { return fmEventList; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBCUUPFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBCUUPFunction.java new file mode 100644 index 0000000..cee385b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBCUUPFunction.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GNBCUUPFunction { + + private String idGNBCUUPFunction; + + private Attributes attributes; + + public String getIdGNBCUUPFunction() { + return idGNBCUUPFunction; + } + + public void setIdGNBCUUPFunction(String idGNBCUUPFunction) { + this.idGNBCUUPFunction = idGNBCUUPFunction; + } + + public Attributes getAttributes() { + return attributes; + } + + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + + public GNBCUUPFunction() { + + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBDUFunction.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBDUFunction.java new file mode 100644 index 0000000..a0dba9e --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/GNBDUFunction.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GNBDUFunction { + + private String idGNBDUFunction; + + private Attributes attributes; + + @JsonProperty("NRCellDU") + public List<NRCellDU> nRCellDU; + + public String getIdGNBDUFunction() { + return idGNBDUFunction; + } + + public void setIdGNBDUFunction(String idGNBDUFunction) { + this.idGNBDUFunction = idGNBDUFunction; + } + + public Attributes getAttributes() { + return attributes; + } + + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + + public List<NRCellDU> getnRCellDU() { + return nRCellDU; + } + + public void setnRCellDU(List<NRCellDU> nRCellDU) { + this.nRCellDU = nRCellDU; + } + + public GNBDUFunction() { + + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java index 8f9de10..e84bfed 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java @@ -17,30 +17,30 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.websocket.model; import java.util.List; public class Measurement { - + private int measurementInterval; private List<AdditionalMeasurements> additionalMeasurements; - + public int getMeasurementInterval() { return measurementInterval; } - + public void setMeasurementInterval(int measurementInterval) { this.measurementInterval = measurementInterval; } - + public List<AdditionalMeasurements> getAdditionalMeasurements() { return additionalMeasurements; } - - public void setAdditionalMeasurements( - List<AdditionalMeasurements> additionalMeasurements) { + + public void setAdditionalMeasurements(List<AdditionalMeasurements> additionalMeasurements) { this.additionalMeasurements = additionalMeasurements; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java index da4bf92..28fd704 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java @@ -23,11 +23,17 @@ package org.onap.ransim.websocket.model; public class MessageTypes { public final static String RC_TO_HC_FMDATA = "FmData"; public final static String RC_TO_HC_PMDATA = "PmData"; - public final static String RC_TO_HC_SETCONFIGTOPO = "SetConfigTopology"; + public final static String RC_TO_HC_SETCONFIGTOPO = "INITIAL_CONFIG"; public final static String RC_TO_HC_UPDCELL = "UpdateCell"; - public final static String RC_TO_HC_PING = "ping"; - + public final static String RC_TO_HC_PING = "PING"; + public final static String RC_TO_HC_PMFILEDATA = "RC_TO_HC_PMFILEDATA"; public final static String HC_TO_RC_MODPCI = "ModifyPci"; public final static String HC_TO_RC_MODANR = "ModifyAnr"; - + public final static String HC_TO_RC_RTRIC = "RTRIC_CONFIG"; + public final static String HC_TO_RC_RRM_POLICY = "HC_TO_RC_RRM_POLICY"; + public final static String HC_TO_RC_PLMN = "HC_TO_RC_PLMN"; + public final static String HC_TO_RC_SLICE_PROFILE = "HC_TO_RC_SLICE_PROFILE"; + public final static String HC_TO_RC_RRM_POLICY_DEL = "HC_TO_RC_RRM_POLICY_DEL"; + public final static String HC_TO_RC_PLMN_DEL = "HC_TO_RC_PLMN_DEL"; + public final static String HC_TO_RC_SLICE_PROFILE_DEL = "HC_TO_RC_SLICE_PROFILE_DEL"; } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java index 30ec5d0..a85d846 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java @@ -23,33 +23,33 @@ package org.onap.ransim.websocket.model; import java.util.List; public class ModifyNeighbor { - + private String pnfName; private String cellId; private List<NeighborHo> neighborList; - + public String getPnfName() { return pnfName; } - + public void setPnfName(String pnfName) { this.pnfName = pnfName; } - + public String getCellId() { return cellId; } - + public void setCellId(String cellId) { this.cellId = cellId; } - + public List<NeighborHo> getNeighborList() { return neighborList; } - + public void setNeighborList(List<NeighborHo> neighborList) { this.neighborList = neighborList; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java index 6a52624..7687f22 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java @@ -55,20 +55,15 @@ public class ModifyPci { } public ModifyPci() { - // TODO Auto-generated constructor stub } /** * Modify Pci value from sdnr. * - * @param pnfName - * server id name - * @param pciId - * pci number - * @param cellId - * node id for the cell - * @param neighborList - * neighbor list for the cell + * @param pnfName server id name + * @param pciId pci number + * @param cellId node id for the cell + * @param neighborList neighbor list for the cell */ public ModifyPci(String pnfName, long pciId, String cellId, List<Neighbor> neighborList) { super(); diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java new file mode 100644 index 0000000..bc6003f --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NRCellDU.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class NRCellDU { + + private String idNRCellDU; + + private Attributes attributes; + + public String getIdNRCellDU() { + return idNRCellDU; + } + + public void setIdNRCellDU(String idNRCellDU) { + this.idNRCellDU = idNRCellDU; + } + + public Attributes getAttributes() { + return attributes; + } + + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + + public NRCellDU(Attributes attributes) { + super(); + this.attributes = attributes; + } + + public NRCellDU() { + + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NearRTRIC.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NearRTRIC.java new file mode 100644 index 0000000..0178fa1 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NearRTRIC.java @@ -0,0 +1,76 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class NearRTRIC { + + private String idNearRTRIC; + + private Attributes attributes; + + @JsonProperty("GNBDUFunction") + private List<GNBDUFunction> gNBDUFunction; + + @JsonProperty("GNBCUUPFunction") + private List<GNBCUUPFunction> gNBCUUPFunction; + + public String getIdNearRTRIC() { + return idNearRTRIC; + } + + public void setIdNearRTRIC(String idNearRTRIC) { + this.idNearRTRIC = idNearRTRIC; + } + + public Attributes getAttributes() { + return attributes; + } + + public void setAttributes(Attributes attributes) { + this.attributes = attributes; + } + + public List<GNBDUFunction> getgNBDUFunction() { + return gNBDUFunction; + } + + public void setgNBDUFunction(List<GNBDUFunction> gNBDUFunction) { + this.gNBDUFunction = gNBDUFunction; + } + + public List<GNBCUUPFunction> getgNBCUUPFunction() { + return gNBCUUPFunction; + } + + public void setgNBCUUPFunction(List<GNBCUUPFunction> gNBCUUPFunction) { + this.gNBCUUPFunction = gNBCUUPFunction; + } + + public NearRTRIC() { + + } +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java index 65c6940..e64caf0 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java @@ -80,6 +80,7 @@ public class Neighbor { public void setBlacklisted(boolean blacklisted) { this.blacklisted = blacklisted; } + @Override public String toString() { return "Neighbor [nodeId=" + nodeId + ", physicalCellId=" + physicalCellId + ", serverId=" + serverId diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java index 5b7f41a..8d8abd7 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java @@ -21,31 +21,33 @@ package org.onap.ransim.websocket.model; public class NeighborHo { - + private String nodeId; private long pciId; private boolean blacklisted; - + public String getNodeId() { return nodeId; } + public void setNodeId(String nodeId) { this.nodeId = nodeId; } - + public long getPciId() { return pciId; } + public void setPciId(long pciId) { this.pciId = pciId; } + public boolean isBlacklisted() { return blacklisted; } + public void setBlacklisted(boolean blacklisted) { this.blacklisted = blacklisted; } - - - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java index 3fb63b7..da64c0c 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java @@ -25,7 +25,7 @@ import java.util.List; public class PmMessage { List<EventPm> eventPmList; - + public void setEventPmList(List<EventPm> data) { this.eventPmList = data; } @@ -33,5 +33,5 @@ public class PmMessage { public List<EventPm> getEventPmList() { return eventPmList; } - + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RanNetwork.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RanNetwork.java new file mode 100644 index 0000000..cd72f18 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RanNetwork.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RanNetwork { + + @JsonProperty("NearRTRIC") + private List<NearRTRIC> nearRTRIC; + + public List<NearRTRIC> getNearRTRIC() { + return nearRTRIC; + } + + public void setNearRTRIC(List<NearRTRIC> nearRTRIC) { + this.nearRTRIC = nearRTRIC; + } + + public RanNetwork() { + + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SNSSAI.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SNSSAI.java new file mode 100644 index 0000000..2e8d78b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SNSSAI.java @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +import java.util.*; + +public class SNSSAI { + + private String sNssai; + + private List<ConfigData> configData; + + public String getSNssai() { + return sNssai; + } + + public void setSNssai(String sNssai) { + this.sNssai = sNssai; + } + + public List<ConfigData> getConfigData() { + return configData; + } + + public void setConfigData(List<ConfigData> configData) { + this.configData = configData; + } + + public SNSSAI() { + + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java index 9b22ebd..4cec62b 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java @@ -37,14 +37,10 @@ public class SetConfigTopology { /** * Cell details for the given netconf server. * - * @param serverId - * netconf server id - * @param ip - * ip address - * @param netconfPort - * port number - * @param topology - * cell topology for given server id + * @param serverId netconf server id + * @param ip ip address + * @param netconfPort port number + * @param topology cell topology for given server id */ public SetConfigTopology(String serverId, String ip, String netconfPort, List<Topology> topology) { super(); diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SlicingPmMessage.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SlicingPmMessage.java new file mode 100644 index 0000000..077abcd --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SlicingPmMessage.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.websocket.model; + +public class SlicingPmMessage { + + private String sourceName; + private String fileName; + private double startEpochMicrosec; + private double lastEpochMicrosec; + private String pmData; + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public double getStartEpochMicrosec() { + return startEpochMicrosec; + } + + public void setStartEpochMicrosec(double startEpochMicrosec) { + this.startEpochMicrosec = startEpochMicrosec; + } + + public double getLastEpochMicrosec() { + return lastEpochMicrosec; + } + + public void setLastEpochMicrosec(double lastEpochMicrosec) { + this.lastEpochMicrosec = lastEpochMicrosec; + } + + public String getPmData() { + return pmData; + } + + public void setPmData(String pmData) { + this.pmData = pmData; + } + + public SlicingPmMessage(String sourceName, String fileName, double startEpochMicrosec, double lastEpochMicrosec, + String pmData) { + this.sourceName = sourceName; + this.fileName = fileName; + this.startEpochMicrosec = startEpochMicrosec; + this.lastEpochMicrosec = lastEpochMicrosec; + this.pmData = pmData; + } + + public SlicingPmMessage() { + + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java index b99f64a..56ce746 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java @@ -65,14 +65,10 @@ public class Topology { /** * Contails the necessary cell details. * - * @param pnfName - * server id name - * @param pciId - * pci number - * @param cellId - * node id for the cel - * @param neighborList - * neighbor list for the cell + * @param pnfName server id name + * @param pciId pci number + * @param cellId node id for the cel + * @param neighborList neighbor list for the cell */ public Topology(String pnfName, long pciId, String cellId, List<Neighbor> neighborList) { super(); diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java index 5794fb1..43494a1 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java @@ -65,14 +65,10 @@ public class UpdateCell { /** * Update cell details based on input. * - * @param serverId - * netconf server id - * @param ip - * ip address - * @param netconfPort - * port number - * @param oneCell - * topology details + * @param serverId netconf server id + * @param ip ip address + * @param netconfPort port number + * @param oneCell topology details */ public UpdateCell(String serverId, String ip, String netconfPort, Topology oneCell) { super(); 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 db94bfd..3061fad 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 @@ -23,95 +23,93 @@ package org.onap.ransim.websocket.server; import java.io.IOException; import javax.websocket.CloseReason; +import javax.websocket.EncodeException; import javax.websocket.OnClose; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; -import javax.websocket.EncodeException; import org.apache.log4j.Logger; -import org.onap.ransim.rest.api.controller.RansimController; +import org.onap.ransim.rest.api.services.RansimControllerServices; import org.onap.ransim.websocket.model.DeviceData; import org.onap.ransim.websocket.model.DeviceDataDecoder; import org.onap.ransim.websocket.model.DeviceDataEncoder; import org.onap.ransim.websocket.model.MessageTypes; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; -@ServerEndpoint(value = "/RansimAgent/{IpPort}", encoders = { DeviceDataEncoder.class }, decoders = { DeviceDataDecoder.class }) +@Controller +@ServerEndpoint( + value = "/RansimAgent/{IpPort}", + encoders = {DeviceDataEncoder.class}, + decoders = {DeviceDataDecoder.class}) public class RansimWebSocketServer { - + static Logger log = Logger.getLogger(RansimWebSocketServer.class.getName()); - + + private static RansimControllerServices rscServices; + + @Autowired + public void setRscServices(RansimControllerServices service) { + this.rscServices = service; + } + /** * Set of actions to be done when connection is opened. * - * @param session - * Session details - * @param ipPort - * ip address of the agent + * @param session Session details + * @param ipPort ip address of the agent */ @OnOpen public void onOpen(Session session, @PathParam("IpPort") String ipPort) { - log.info("WSS Ransim client(" + ipPort + ") opened a connection with id " + session.getId()); - try { - String serverId = RansimController.getRansimController().addWebSocketSessions(ipPort, - session); - if (serverId != null) { - log.info("New websocket session added for " + serverId); - RansimController.getRansimController().sendInitialConfigForNewAgent(ipPort, - serverId); - } else { - log.info("RansimWebSocketServer: No assigned ServerId found - No intial configuration sent to New Agent " - + ipPort); - } - } catch (Exception e) { - log.info("Exception in onOpen:", e); - } - } - - /* - @OnMessage - public void onMessage(String messageStr, Session session, @PathParam("IpPort") String ipPort) { - log.info("WSS Str Message received from client(" + ipPort + ") with id " + session.getId()); try { - if (messageStr != null) { - DeviceData message = new DeviceDataDecoder().decode(messageStr); - if (message.getMessage() == null || message.getMessage().trim().equals("")) { - log.debug("Periodic ping message.... ignore"); - return; - } else { - - if (message.getType().equals(MessageTypes.HC_TO_RC_MODPCI)) { - RansimController.getRansimController().handleModifyPciFromSdnr( - message.getMessage(), session, ipPort); - } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { - RansimController.getRansimController().handleModifyNeighborFromSdnr( - message.getMessage(), session, ipPort); + String useCaseType = RansimControllerServices.useCaseType; + switch (useCaseType) { + case "sonUsecase": + log.info("RansimWebSocketServer : Assign serverId wrt SlicingUsecase"); + String serverId = rscServices.addWebSocketSessions(ipPort, session); + if (serverId != null) { + log.info("New websocket session added for " + serverId); + rscServices.sendInitialConfigForNewAgent(ipPort, serverId); + } else { + log.info( + "RansimWebSocketServer: No assigned ServerId found - No intial configuration sent to New Agent " + + ipPort); } - } + break; + case "ranSlicingUsecase": + log.info("RansimWebSocketServer : Assign serverId wrt RANSlicingUsecase"); + String ranServerId = rscServices.addRanWebSocketSessions(ipPort, session); + if (ranServerId != null) { + log.info("New websocket session added for " + ranServerId); + rscServices.sendRanInitialConfigForNewAgent(ipPort, ranServerId); + } else { + log.info( + "RansimWebSocketServer: No assigned ServerId found - No intial configuration sent to New Agent " + + ipPort); + } + break; + default: + log.info("RansimWebSocketServer: No assigned ServerId found"); } } catch (Exception e) { - log.info("Exception in onMessage:", e); + log.info("Exception in onOpen:", e); } } - */ - - + /** * Handles the message sent from the agent. * - * @param message - * message sent from the agent - * @param session - * session details - * @param ipPort - * ip address - * public void onMessage(DeviceData message, Session session, @PathParam("IpPort") String ipPort) { + * @param message message sent from the agent + * @param session session details + * @param ipPort ip address public void onMessage(DeviceData message, Session + * session, @PathParam("IpPort") String ipPort) { */ @OnMessage - public void onMessage(final DeviceData message, final Session session, @PathParam("IpPort") String ipPort) - throws IOException, EncodeException { + public void onMessage(final DeviceData message, final Session session, @PathParam("IpPort") String ipPort) + throws IOException, EncodeException { log.info("WSS Obj Message received from client(" + ipPort + ") with id " + session.getId()); try { if (message != null) { @@ -119,43 +117,61 @@ public class RansimWebSocketServer { log.debug("Periodic ping message.... ignore"); return; } else { - + if (message.getType().equals(MessageTypes.HC_TO_RC_MODPCI)) { log.info("Modify pci message received"); - RansimController.getRansimController().handleModifyPciFromSdnr( - message.getMessage(), session, ipPort); + rscServices.handleModifyPciFromSdnr(message.getMessage(), session, ipPort); } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { log.info("Modify anr message received"); - RansimController.getRansimController().handleModifyNeighborFromSdnr( - message.getMessage(), session, ipPort); + rscServices.handleModifyNeighborFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_RTRIC)) { + log.info("Distribute RTRIC Config message received"); + rscServices.handleRTRICConfigFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_RRM_POLICY)) { + log.info("Add RRMPolicyRatio message received"); + rscServices.handleRRMPolicyRatioUpdateFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_PLMN)) { + log.info("Add PLMNInfo message received"); + 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); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_RRM_POLICY_DEL)) { + log.info("Delete RRMPolicyRatio message received"); + rscServices.handleRRMPolicyRatioDeleteFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_PLMN_DEL)) { + log.info("Delete PLMNInfo message received"); + rscServices.handlePLMNInfoDeleteFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_SLICE_PROFILE_DEL)) { + log.info("Delete SliceProfile message received"); + rscServices.handleSliceProfileDeleteFromSdnr(message.getMessage(), session, ipPort); } + } } } catch (Exception e) { log.info("Exception in onMessage:", e); } } - + /** * Set of actions to be done when connection is closed. * - * @param reason - * reason the session was closed - * @param session - * session details - * @param ipPort - * ip address + * @param reason reason the session was closed + * @param session session details + * @param ipPort ip address */ @OnClose public void onClose(CloseReason reason, Session session, @PathParam("IpPort") String ipPort) { try { - log.info("WSS Closing client(" + ipPort + ") cxn with id " + session.getId() + "due to " + reason.getReasonPhrase()); - RansimController.getRansimController().removeWebSocketSessions(ipPort); + log.info("WSS Closing client(" + ipPort + ") cxn with id " + session.getId() + "due to " + + reason.getReasonPhrase()); + rscServices.removeWebSocketSessions(ipPort); } catch (Exception e) { log.info("Exception in onClose:", e); } } - + public static void sendUpdateCellMessage(String str, Session session) { DeviceData data = new DeviceData(); data.setType(MessageTypes.RC_TO_HC_UPDCELL); @@ -166,7 +182,7 @@ public class RansimWebSocketServer { e.printStackTrace(); } } - + public static void sendPmMessage(String str, Session session) { DeviceData data = new DeviceData(); data.setType(MessageTypes.RC_TO_HC_PMDATA); @@ -178,7 +194,19 @@ public class RansimWebSocketServer { e.printStackTrace(); } } - + + public static void sendIntelligentSlicingPmData(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_PMFILEDATA); + data.setMessage(str); + log.info("data.setMessage: " + data.getMessage()); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + public static void sendFmMessage(String str, Session session) { DeviceData data = new DeviceData(); data.setType(MessageTypes.RC_TO_HC_FMDATA); @@ -189,7 +217,7 @@ public class RansimWebSocketServer { e.printStackTrace(); } } - + public static void sendSetConfigTopologyMessage(String str, Session session) { DeviceData data = new DeviceData(); data.setType(MessageTypes.RC_TO_HC_SETCONFIGTOPO); @@ -200,7 +228,18 @@ public class RansimWebSocketServer { e.printStackTrace(); } } - + + public static void sendSetReconfigureMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.HC_TO_RC_RTRIC); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + public static void sendPingMessage(Session session) { DeviceData data = new DeviceData(); data.setType(MessageTypes.RC_TO_HC_PING); @@ -211,7 +250,7 @@ public class RansimWebSocketServer { e.printStackTrace(); } } - + private static void sendMessage(DeviceData data, Session session) { try { session.getBasicRemote().sendObject(data); diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/META-INF/persistence.xml b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index bbfb0f3..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - ONAP-PAP-REST - ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ============LICENSE_END========================================================= - --> -<persistence xmlns="http://java.sun.com/xml/ns/persistence" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" - version="2.0"> - <persistence-unit name="ransimctrlrdb" transaction-type="RESOURCE_LOCAL"> - <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - <class>org.onap.ransim.rest.api.models.CellDetails</class> - <class>org.onap.ransim.rest.api.models.CellNeighbor</class> - <class>org.onap.ransim.rest.api.models.NetconfServers</class> - <class>org.onap.ransim.rest.api.models.OperationLog</class> - <class>org.onap.ransim.rest.api.models.NeighborDetails</class> - - <properties> - <property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" /> - <property name="javax.persistence.jdbc.url" value="jdbc:mariadb://mariadb:3306/ransim_db"/> - <property name="javax.persistence.jdbc.user" value="root"/> - <property name="javax.persistence.jdbc.password" value="secret"/> - <property name="eclipselink.target-database" value="MySQL"/> - <property name="eclipselink.ddl-generation" value="create-or-extend-tables"/> - <property name="eclipselink.logging.level" value="FINEST"/> - </properties> - </persistence-unit> -</persistence> diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties new file mode 100644 index 0000000..02a81ec --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties @@ -0,0 +1,8 @@ +spring.datasource.username=root +spring.datasource.password=secret +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.jpa.hibernate.ddl-auto=update +spring.datasource.url=jdbc:mariadb://mariadb:3306/ransim_db +hibernate.dialect=org.hibernate.dialect.MariaDBDialect +spring.config.location=/tmp/ransim-install/config/ +spring.config.name=ransim diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/dumpfileNames.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/dumpfileNames.properties new file mode 100644 index 0000000..4f9be36 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/dumpfileNames.properties @@ -0,0 +1 @@ +defaultFiles=latestDump.json,1050cells.json,sample.json
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java index ff88afa..4c886e3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimController.java @@ -17,11 +17,13 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.HashMap; @@ -35,23 +37,23 @@ import mockit.MockUp; import org.junit.Test; import org.junit.runner.RunWith; -//import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.onap.ransim.rest.api.models.CellDetails; import org.onap.ransim.rest.api.models.CellNeighbor; import org.onap.ransim.rest.api.models.FmAlarmInfo; -import org.onap.ransim.rest.api.models.GetNeighborList; import org.onap.ransim.rest.api.models.NeighborDetails; import org.onap.ransim.rest.api.models.NeihborId; import org.onap.ransim.rest.api.models.NetconfServers; +import org.onap.ransim.rest.api.services.RansimControllerServices; +import org.onap.ransim.rest.api.services.RansimRepositoryService; import org.onap.ransim.rest.client.RestClient; import org.onap.ransim.websocket.model.CommonEventHeaderFm; import org.onap.ransim.websocket.model.EventFm; import org.onap.ransim.websocket.model.FaultFields; import org.springframework.context.annotation.PropertySource; - -import com.google.gson.Gson; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; /** * @author ubuntu16 @@ -60,203 +62,251 @@ import com.google.gson.Gson; @RunWith(MockitoJUnitRunner.class) @PropertySource("classpath:ransim.properties") public class TestRansimController { - @Test - public void testGetRansimController() { - - RansimController rc = RansimController.getRansimController(); - assertNotNull(rc); - } - - @Test - public void testsetNetconfServers() { - // fail("Not yet implemented"); - RansimController rscontroller = Mockito.mock(RansimController.class); - CellDetails cell1 = new CellDetails("Chn01", 1, "nc1"); - CellDetails cell2 = new CellDetails("Chn02", 2, "nc1"); - CellDetails cell3 = new CellDetails("Chn03", 3, "nc1"); - CellDetails cell4 = new CellDetails("Chn04", 4, "nc1"); - - Set<CellDetails> cells = new HashSet<CellDetails>(); - cells.add(cell1); - cells.add(cell2); - cells.add(cell3); - - NetconfServers server = new NetconfServers("nc1", null, null, cells); - - new MockUp<RansimControllerDatabase>() { - @Mock - NetconfServers getNetconfServer(String serverId) { - - return server; - } - }; - new MockUp<RansimControllerDatabase>() { - @Mock - CellDetails getCellDetail(String nodeId) { - - return cell4; - } - }; - new MockUp<RansimControllerDatabase>() { - @Mock - void mergeNetconfServers(NetconfServers netconfServers) { - - } - }; - - rscontroller.setNetconfServers("Chn04"); - - boolean check = server.getCells().contains(cell4); - - assertTrue(check); - - } - - @Test - public void testGenerateNeighborList() { - // fail("Not yet implemented"); - RansimController rscontroller = Mockito.mock(RansimController.class); - Set<NeighborDetails> neighborList = new HashSet<NeighborDetails>(); - NeighborDetails nbr1 = new NeighborDetails(new NeihborId("Chn00", "Chn01"), false); - NeighborDetails nbr2 = new NeighborDetails(new NeihborId("Chn00", "Chn02"), false); - NeighborDetails nbr3 = new NeighborDetails(new NeihborId("Chn00", "Chn03"), true); - - neighborList.add(nbr1); - neighborList.add(nbr2); - neighborList.add(nbr3); - - CellDetails cell0 = new CellDetails("Chn00", 4, "nc1"); - CellDetails cell1 = new CellDetails("Chn01", 1, "nc1"); - CellDetails cell2 = new CellDetails("Chn02", 2, "nc1"); - CellDetails cell3 = new CellDetails("Chn03", 3, "nc1"); - - CellNeighbor cellNbr = new CellNeighbor(); - cellNbr.setNodeId("Chn00"); - cellNbr.setNeighborList(neighborList); - - new MockUp<RansimControllerDatabase>() { - @Mock - CellNeighbor getCellNeighbor(String nodeId) { - if (nodeId.equals("Chn00")) { - return cellNbr; - } else { - return null; - } - - } - }; - - new MockUp<RansimControllerDatabase>() { - @Mock - CellDetails getCellDetail(String nodeId) { - if (nodeId.equals("Chn00")) { - return cell0; - } else if (nodeId.equals("Chn01")) { - return cell1; - } else if (nodeId.equals("Chn02")) { - return cell2; - } else if (nodeId.equals("Chn03")) { - return cell3; - } else { - return null; - } - - } - }; - - /* - * GetNeighborList nbrListFct = rscontroller.generateNeighborList("Chn00"); - * - * boolean result = false; - * - * if (nbrListFct.getCellsWithHo().contains(cell1)) { if - * (nbrListFct.getCellsWithHo().contains(cell2)) { if - * (nbrListFct.getCellsWithNoHo().contains(cell3)) { result = true; } } } - * - * assertTrue(result); - */ - - } - - @Test - public void testSetEventFm() { - // fail("Not yet implemented"); - RansimController rscontroller = Mockito.mock(RansimController.class); - Map<String, String> alarmAdditionalInformation = new HashMap<String, String>(); - alarmAdditionalInformation.put("networkId", "abc"); - alarmAdditionalInformation.put("collisions", "1"); - alarmAdditionalInformation.put("confusions", "0"); - CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm("Chn00", "", "nc1", 0, 0); - FaultFields faultFields = new FaultFields("RanPciCollisionConfusionOccurred", "other", "Collision", "CRITICAL", - alarmAdditionalInformation); - EventFm checkObj = new EventFm(commonEventHeader, faultFields); - - new MockUp<RansimController>() { - @Mock - String getUuid() { - return ""; - } - }; - new MockUp<System>() { - @Mock - public long currentTimeMillis() { - return (long) 0; - } - }; - - String networkId = "abc"; - String ncServer = "nc1"; - String cellId = "Chn00"; - FmAlarmInfo issue = new FmAlarmInfo("Collision", "1", "0"); - /* - * EventFm eventObj = rscontroller.setEventFm(networkId, ncServer, cellId, - * issue); - * - * boolean result = false; - * - * Gson gson = new Gson(); String eventStr = gson.toJson(eventObj); String - * checkStr = gson.toJson(checkObj); - * - * System.out.println("eventStr: " + eventStr); System.out.println("checkStr: " - * + checkStr); - * - * if (eventStr.equals(checkStr)) { result = true; } - * - * assertTrue(result); - */ - } - - - - //@Test - public void testStopAllCells() { - RansimController rscontroller = Mockito.mock(RansimController.class); - - new MockUp<RansimControllerDatabase>() { - @Mock - List<NetconfServers> getNetconfServersList() { - System.out.println("getNetconfServersList"); - List<NetconfServers> ns = new ArrayList<NetconfServers>(); - NetconfServers n1 = new NetconfServers("nc1", null, null, null); - NetconfServers n2 = new NetconfServers("nc2", null, null, null); - ns.add(n1); - ns.add(n2); - return ns; - } - }; - - new MockUp<RestClient>() { - @Mock - public String sendUnmountRequestToSdnr(String serverId, String ip, int port, String sdnrUsername, - String sdnrPassword) { - System.out.println("sendUnmountRequestToSdnr"); - return ""; - } - }; - - String result = rscontroller.stopAllCells(); - System.out.println("testStopAllCells: " + result); - assertEquals("Netconf servers unmounted.", result); - } - -}
\ No newline at end of file + + @Test + public void testGetRansimController() { + RansimControllerServices rc = Mockito.mock(RansimControllerServices.class); + assertNotNull(rc); + } + + @Test + public void testsetNetconfServers() { + // fail("Not yet implemented"); + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); + CellDetails cell1 = new CellDetails("Chn01", 1, "nc1"); + CellDetails cell2 = new CellDetails("Chn02", 2, "nc1"); + CellDetails cell3 = new CellDetails("Chn03", 3, "nc1"); + CellDetails cell4 = new CellDetails("Chn04", 4, "nc1"); + + Set<CellDetails> cells = new HashSet<CellDetails>(); + cells.add(cell1); + cells.add(cell2); + cells.add(cell3); + cells.add(cell4); + + NetconfServers server = new NetconfServers("nc1", null, null, cells); + + new MockUp<RansimRepositoryService>() { + @Mock + NetconfServers getNetconfServer(String serverId) { + + return server; + } + }; + new MockUp<RansimRepositoryService>() { + @Mock + CellDetails getCellDetail(String nodeId) { + + return cell4; + } + }; + new MockUp<RansimRepositoryService>() { + @Mock + void mergeNetconfServers(NetconfServers netconfServers) { + + } + }; + + rscontroller.setNetconfServers("Chn04"); + + boolean check = server.getCells().contains(cell4); + + assertTrue(check); + + } + + @Test + public void testGenerateNeighborList() { + // fail("Not yet implemented"); + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); + Set<NeighborDetails> neighborList = new HashSet<NeighborDetails>(); + NeighborDetails nbr1 = new NeighborDetails(new NeihborId("Chn00", "Chn01"), false); + NeighborDetails nbr2 = new NeighborDetails(new NeihborId("Chn00", "Chn02"), false); + NeighborDetails nbr3 = new NeighborDetails(new NeihborId("Chn00", "Chn03"), true); + + neighborList.add(nbr1); + neighborList.add(nbr2); + neighborList.add(nbr3); + + CellDetails cell0 = new CellDetails("Chn00", 4, "nc1"); + CellDetails cell1 = new CellDetails("Chn01", 1, "nc1"); + CellDetails cell2 = new CellDetails("Chn02", 2, "nc1"); + CellDetails cell3 = new CellDetails("Chn03", 3, "nc1"); + + CellNeighbor cellNbr = new CellNeighbor(); + cellNbr.setNodeId("Chn00"); + cellNbr.setNeighborList(neighborList); + + new MockUp<RansimRepositoryService>() { + @Mock + CellNeighbor getCellNeighbor(String nodeId) { + if (nodeId.equals("Chn00")) { + return cellNbr; + } else { + return null; + } + + } + }; + + new MockUp<RansimRepositoryService>() { + @Mock + CellDetails getCellDetail(String nodeId) { + if (nodeId.equals("Chn00")) { + return cell0; + } else if (nodeId.equals("Chn01")) { + return cell1; + } else if (nodeId.equals("Chn02")) { + return cell2; + } else if (nodeId.equals("Chn03")) { + return cell3; + } else { + return null; + } + + } + }; + + /* + * GetNeighborList nbrListFct = rscontroller.generateNeighborList("Chn00"); + * + * boolean result = false; + * + * if (nbrListFct.getCellsWithHo().contains(cell1)) { if + * (nbrListFct.getCellsWithHo().contains(cell2)) { if + * (nbrListFct.getCellsWithNoHo().contains(cell3)) { result = true; } } } + * + * assertTrue(result); + */ + + } + + @Test + public void testSetEventFm() { + // fail("Not yet implemented"); + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); + Map<String, String> alarmAdditionalInformation = new HashMap<String, String>(); + alarmAdditionalInformation.put("networkId", "abc"); + alarmAdditionalInformation.put("collisions", "1"); + alarmAdditionalInformation.put("confusions", "0"); + CommonEventHeaderFm commonEventHeader = new CommonEventHeaderFm("Chn00", "", "nc1", 0, 0); + FaultFields faultFields = new FaultFields("RanPciCollisionConfusionOccurred", "other", "Collision", "CRITICAL", + alarmAdditionalInformation); + EventFm checkObj = new EventFm(commonEventHeader, faultFields); + + new MockUp<RansimControllerServices>() { + @Mock + String getUuid() { + return ""; + } + }; + new MockUp<System>() { + @Mock + public long currentTimeMillis() { + return (long) 0; + } + }; + + String networkId = "abc"; + String ncServer = "nc1"; + String cellId = "Chn00"; + FmAlarmInfo issue = new FmAlarmInfo("Collision", "1", "0"); + /* + * EventFm eventObj = rscontroller.setEventFm(networkId, ncServer, cellId, + * issue); + * + * boolean result = false; + * + * Gson gson = new Gson(); String eventStr = gson.toJson(eventObj); String + * checkStr = gson.toJson(checkObj); + * + * System.out.println("eventStr: " + eventStr); System.out.println("checkStr: " + * + checkStr); + * + * if (eventStr.equals(checkStr)) { result = true; } + * + * assertTrue(result); + */ + } + + // @Test + public void testStopAllCells() { + RansimControllerServices rscontroller = Mockito.mock(RansimControllerServices.class); + + new MockUp<RansimRepositoryService>() { + @Mock + List<NetconfServers> getNetconfServersList() { + System.out.println("getNetconfServersList"); + List<NetconfServers> ns = new ArrayList<NetconfServers>(); + NetconfServers n1 = new NetconfServers("nc1", null, null, null); + NetconfServers n2 = new NetconfServers("nc2", null, null, null); + ns.add(n1); + ns.add(n2); + return ns; + } + }; + + new MockUp<RestClient>() { + @Mock + public String sendUnmountRequestToSdnr(String serverId, String ip, int port, String sdnrUsername, + String sdnrPassword) { + System.out.println("sendUnmountRequestToSdnr"); + return ""; + } + }; + + String result = rscontroller.stopAllSimulation(); + System.out.println("testStopAllCells: " + result); + assertEquals("Netconf servers unmounted.", result); + } + + @Test + public void testStartRanSimulation() throws Exception { + + ResponseEntity<String> rsEntity = new ResponseEntity<>("Simulation started", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.startRanSliceSimulation()).thenReturn(rsEntity); + assertEquals(rscontroller.startRanSliceSimulation(), rsEntity); + + } + + @Test + public void testFailureStartRanSimulation() throws Exception { + + RansimController rscontroller = new RansimController(); + ResponseEntity<String> result = rscontroller.startRanSliceSimulation(); + assertEquals(result.getStatusCode(), HttpStatus.INTERNAL_SERVER_ERROR); + + } + + @Test + public void testStopRanSimulation() throws Exception { + + ResponseEntity<String> rsEntity = new ResponseEntity<>("Simulation stopped", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.stopRanSliceSimulation()).thenReturn(rsEntity); + assertEquals(rscontroller.stopRanSliceSimulation(), rsEntity); + + } + + @Test + public void testGenerateIntelligentSlicingPmData() throws Exception { + + ResponseEntity<String> rsEntity = new ResponseEntity<>("IntelligentSlicing PM data generated", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.generateIntelligentSlicingPmData()).thenReturn(rsEntity); + assertEquals(rscontroller.generateIntelligentSlicingPmData(), rsEntity); + + } + + @Test + public void testStopIntelligentSlicingPmData() throws Exception { + + ResponseEntity<String> rsEntity = new ResponseEntity<>("Stopped PM data generation.", HttpStatus.OK); + RansimController rscontroller = Mockito.mock(RansimController.class); + when(rscontroller.stopIntelligentSlicingPmData()).thenReturn(rsEntity); + assertEquals(rscontroller.stopIntelligentSlicingPmData(), rsEntity); + + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimControllerServices.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimControllerServices.java index af3659e..567f28d 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimControllerServices.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/controller/TestRansimControllerServices.java @@ -42,34 +42,32 @@ public class TestRansimControllerServices { @Test public void testGetOperationLog() { ResponseEntity<String> rsEntity = Mockito.mock(ResponseEntity.class); - + EntityManagerFactory emfactory = Mockito.mock(EntityManagerFactory.class); EntityManager entityManager = Mockito.mock(EntityManager.class); Mockito.when(emfactory.createEntityManager()).thenReturn(entityManager); - + TypedQuery<CellDetails> query = Mockito.mock(TypedQuery.class); Mockito.when(entityManager.createQuery("from CellDetails cd", CellDetails.class)).thenReturn(query); - + List<CellDetails> cellDetailList = new ArrayList<CellDetails>(); Mockito.when(query.getResultList()).thenReturn(cellDetailList); assertNotNull(rsEntity); - + } - + @Test public void testModifyACell() { - + ResponseEntity<String> rsEntity = Mockito.mock(ResponseEntity.class); - + EntityManagerFactory emfactory = Mockito.mock(EntityManagerFactory.class); EntityManager entityManager = Mockito.mock(EntityManager.class); Mockito.when(emfactory.createEntityManager()).thenReturn(entityManager); - + TypedQuery<CellDetails> query = Mockito.mock(TypedQuery.class); Mockito.when(entityManager.createQuery("from CellDetails cd", CellDetails.class)).thenReturn(query); - - + } - -}
\ No newline at end of file +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java index b9e24fd..c5ad032 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/models/TestApiModels.java @@ -35,7 +35,7 @@ public class TestApiModels { mcell.setNewPhysicalCellId(001L); assertTrue(mcell.getNewPhysicalCellId() == 001); } - + @Test public void testsetNewPhysicalCellId1() { ModifyACellReq mcell = new ModifyACellReq(); diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/services/TestRANSliceConfigServices.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/services/TestRANSliceConfigServices.java new file mode 100644 index 0000000..3ffea5b --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/java/org/onap/ransim/rest/api/services/TestRANSliceConfigServices.java @@ -0,0 +1,354 @@ +/* + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020-2021 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ransim.rest.api.services; + +import static org.junit.Assert.assertEquals; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.ransim.rest.api.models.NSSAIConfig; +import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.rest.web.mapper.GNBCUCPModel; +import org.onap.ransim.rest.web.mapper.GNBCUUPModel; +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.rest.web.mapper.RANSliceInfoModel; +import org.springframework.context.annotation.PropertySource; + +@RunWith(MockitoJUnitRunner.class) +@PropertySource("classpath:ransim.properties") +public class TestRANSliceConfigServices { + + @Mock + RANSliceConfigService rANSliceConfigService; + + ObjectMapper objectMapper = new ObjectMapper(); + + @Test + public void testSaveGNBCUCP() { + String input = + "{\"gNBCUName\":\"cucpserver1\",\"gNBId\":98763,\"gNBIdLength\":5,\"pLMNId\":\"310-410\",\"nFType\":\"CUCP\",\"nearRTRICId\":11,\"cellCUList\":[{\"cellLocalId\":103594000,\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-093\",\"status\":\"ACTIVE\",\"configData\":{\"maxNumberOfConns\":3000}}}]}]}"; + GNBCUCPModel gNBCUCPModel = new GNBCUCPModel(); + try { + gNBCUCPModel = objectMapper.readValue(input, GNBCUCPModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + Mockito.doReturn(gNBCUCPModel).when(rANSliceConfigService).saveGNBCUCP(gNBCUCPModel); + assertEquals(gNBCUCPModel, rANSliceConfigService.saveGNBCUCP(gNBCUCPModel)); + } + + @Test + public void testFetchGNBCUCPData() { + String cuCPName = "cucpserver1"; + GNBCUCPModel gNBCUCPModel = new GNBCUCPModel(); + Mockito.doReturn(gNBCUCPModel).when(rANSliceConfigService).fetchGNBCUCPData(cuCPName); + assertEquals(gNBCUCPModel, rANSliceConfigService.fetchGNBCUCPData(cuCPName)); + } + + @Test + public void testSaveGNBDU() { + String input = + "{\"gNBDUId\":1,\"gNBId\":98763,\"gNBIdLength\":5,\"pLMNId\":\"310-410\",\"gNBDUName\":\"gnduserver1\",\"nFType\":\"DU\",\"nearRTRICId\":11,\"cellDUList\":[{\"cellLocalId\":103593999,\"operationalState\":\"ENABLED\",\"administrativeState\":\"UNLOCKED\",\"cellState\":\"ACTIVE\",\"nRPCI\":12,\"nRTAC\":310,\"resourceType\":\"PRB\",\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":50,\"uLThptPerSlice\":40}}}]}]}"; + GNBDUModel gNBDUModel = new GNBDUModel(); + try { + gNBDUModel = objectMapper.readValue(input, GNBDUModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(gNBDUModel).when(rANSliceConfigService).saveGNBDU(gNBDUModel); + assertEquals(gNBDUModel, rANSliceConfigService.saveGNBDU(gNBDUModel)); + } + + @Test + public void testFetchGNBDUData() { + int gNBDUId = 1; + GNBDUModel gNBDUModel = new GNBDUModel(); + Mockito.doReturn(gNBDUModel).when(rANSliceConfigService).fetchGNBDUData(gNBDUId); + assertEquals(gNBDUModel, rANSliceConfigService.fetchGNBDUData(gNBDUId)); + } + + @Test + public void testSaveGNBCUUP() { + String input = + "{\"gNBCUUPId\":1111,\"gNBId\":98763,\"gNBIdLength\":2,\"resourceType\":\"DRB\",\"nearRTRICId\":11,\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"maxNumberOfConns\":3000}}}]}"; + GNBCUUPModel gNBCUUPModel = new GNBCUUPModel(); + try { + gNBCUUPModel = objectMapper.readValue(input, GNBCUUPModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(gNBCUUPModel).when(rANSliceConfigService).saveGNBCUUP(gNBCUUPModel); + assertEquals(gNBCUUPModel, rANSliceConfigService.saveGNBCUUP(gNBCUUPModel)); + } + + @Test + public void testFetchGNBCUUPData() { + Integer gNBCUUPId = 1111; + String response = + "{\"gNBCUUPId\":1111,\"gNBId\":98763,\"gNBIdLength\":2,\"resourceType\":\"DRB\",\"nearRTRICId\":11,\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"maxNumberOfConns\":3000}}}]}"; + GNBCUUPModel gNBCUUPModel = new GNBCUUPModel(); + try { + gNBCUUPModel = objectMapper.readValue(response, GNBCUUPModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(gNBCUUPModel).when(rANSliceConfigService).fetchGNBCUUPData(gNBCUUPId); + assertEquals(gNBCUUPModel, rANSliceConfigService.fetchGNBCUUPData(gNBCUUPId)); + + } + + @Test + public void testSaveNearRTRIC() { + NearRTRICModel nearRTRIC = new NearRTRICModel(); + String input = + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + try { + nearRTRIC = objectMapper.readValue(input, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(nearRTRIC).when(rANSliceConfigService).saveNearRTRIC(nearRTRIC); + assertEquals(nearRTRIC, rANSliceConfigService.saveNearRTRIC(nearRTRIC)); + } + + @Test + public void testFetchNearRTRICData() { + int nearRTRICId = 11; + String response = + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC = objectMapper.readValue(response, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(nearRTRIC).when(rANSliceConfigService).fetchNearRTRICData(nearRTRICId); + assertEquals(nearRTRIC, rANSliceConfigService.fetchNearRTRICData(nearRTRICId)); + } + + @Test + public void testFindRICsInTA() { + String nSSAI = "01-000100"; + List<NearRTRICModel> ricsList = new ArrayList<>(); + String ricModel = + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC = objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findRICsInTA(Mockito.anyString()); + assertEquals(ricsList, rANSliceConfigService.findRICsInTA(nSSAI)); + } + + @Test + public void testfindNearRTRICofCells() { + List<Integer> cellIds = new ArrayList<Integer>(); + cellIds.add(23456); + cellIds.add(45785); + List<NearRTRICModel> ricsList = new ArrayList<>(); + String ricModel = + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC = objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findNearRTRICofCells(Mockito.anyList()); + assertEquals(ricsList, rANSliceConfigService.findNearRTRICofCells(cellIds)); + } + + @Test + public void testUpdateRANInventory() { + String input = + "{\"ranNFNSSIId\":\"11\",\"ranNSSIList\":[\"ran3\"],\"nSSAIList\":[\"001-003\",\"001-001\"],\"sliceProfilesList\":[{\"sliceProfileId\":12,\"dLThptPerSlice\":1,\"uLThptPerSlice\":2,\"maxNumberofConns\":3,\"sNSSAI\":\"001-003\"}],\"trackingAreaList\":\"Chennai\",\"subnetStatus\":\"ACTIVE\",\"nsstId\":\"NSSTID1\",\"sliceType\":\"eMBB\",\"isShareable\":\"true\"}"; + RANSliceInfoModel inventorynfo = new RANSliceInfoModel(); + try { + inventorynfo = objectMapper.readValue(input, RANSliceInfoModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(inventorynfo).when(rANSliceConfigService).updateRANInventory(Mockito.anyObject()); + assertEquals(inventorynfo, rANSliceConfigService.updateRANInventory(inventorynfo)); + } + + @Test + public void testFetchRANSlice() { + String ranNFNSSIId = "11"; + String input = + "{\"ranNFNSSIId\":\"11\",\"ranNSSIList\":[\"ran3\"],\"nSSAIList\":[\"001-003\",\"001-001\"],\"sliceProfilesList\":[{\"sliceProfileId\":12,\"dLThptPerSlice\":1,\"uLThptPerSlice\":2,\"maxNumberofConns\":3,\"sNSSAI\":\"001-003\"}],\"trackingAreaList\":\"Chennai\",\"subnetStatus\":\"ACTIVE\",\"nsstId\":\"NSSTID1\",\"sliceType\":\"eMBB\",\"isShareable\":\"true\"}"; + RANSliceInfoModel inventorynfo = new RANSliceInfoModel(); + try { + inventorynfo = objectMapper.readValue(input, RANSliceInfoModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Mockito.doReturn(inventorynfo).when(rANSliceConfigService).fetchRANSlice(ranNFNSSIId); + assertEquals(inventorynfo, rANSliceConfigService.fetchRANSlice(ranNFNSSIId)); + } + + @Test + public void testFetchCellsofTA() { + String trackingArea = "Kingston"; + List<String> cellIds = new ArrayList<String>(); + cellIds.add("23456"); + cellIds.add("45785"); + Mockito.doReturn(cellIds).when(rANSliceConfigService).fetchCellsofTA(Mockito.anyString()); + assertEquals(cellIds, rANSliceConfigService.fetchCellsofTA(trackingArea)); + } + + @Test + public void testFetchCUCellsofRIC() { + Integer nearRTRICId = 1; + List<NRCellCUModel> cellCUList = new ArrayList<>(); + Mockito.doReturn(cellCUList).when(rANSliceConfigService).fetchCUCellsofRIC(Mockito.anyInt()); + assertEquals(cellCUList, rANSliceConfigService.fetchCUCellsofRIC(nearRTRICId));; + } + + @Test + public void testFetchDUCellsofRIC() { + String sNSSAI = "001-00001"; + Map<Integer, List<NRCellDUModel>> cellsMap = new HashMap<Integer, List<NRCellDUModel>>(); + Mockito.doReturn(cellsMap).when(rANSliceConfigService).fetchDUCellsofRIC(Mockito.anyString()); + assertEquals(cellsMap, rANSliceConfigService.fetchDUCellsofRIC(sNSSAI));; + } + + @Test + public void testFindNearRTRICByNSSI() { + String ranNFNSSIID = "11"; + List<NearRTRICModel> ricsList = new ArrayList<>(); + String ricModel = + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC = objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findNearRTRICByNSSI(Mockito.anyString()); + assertEquals(ricsList, rANSliceConfigService.findNearRTRICByNSSI(ranNFNSSIID)); + } + + @Test + public void testFindRICsByNSSAI() { + String sNSSAI = "001-00001"; + List<NearRTRICModel> ricsList = new ArrayList<>(); + String ricModel = + "{\"nearRTRICId\":11,\"gNBId\":98763,\"trackingArea\":[\"Kingston\"],\"resourceType\":\"NearRTRIC\",\"ranNFNSSIList\":[\"11\",\"22\"],\"pLMNInfoList\":[{\"pLMNId\":\"310-410\",\"sNSSAI\":{\"sNSSAI\":\"001-003\",\"status\":\"ACTIVE\",\"configData\":{\"dLThptPerSlice\":55,\"uLThptPerSlice\":40}}}]}"; + NearRTRICModel nearRTRIC = new NearRTRICModel(); + try { + nearRTRIC = objectMapper.readValue(ricModel, NearRTRICModel.class); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ricsList.add(nearRTRIC); + Mockito.doReturn(ricsList).when(rANSliceConfigService).findRICsByNSSAI(Mockito.anyString()); + assertEquals(ricsList, rANSliceConfigService.findRICsByNSSAI(sNSSAI)); + } + + @Test + public void testFindSliceProfileconfig() { + String sNSSAI = "001-00001"; + Map<String, Integer> configDetails = new HashMap<String, Integer>(); + configDetails.put("dLThptPerSlice", 40); + configDetails.put("uLThptPerSlice", 50); + Mockito.doReturn(configDetails).when(rANSliceConfigService).findSliceProfileconfig(Mockito.anyString()); + assertEquals(configDetails, rANSliceConfigService.findSliceProfileconfig(sNSSAI)); + } + + @Test + public void testFindSliceeconfig() { + String sNSSAI = "001-00001"; + Map<Integer, NSSAIConfig> configMap = new HashMap<Integer, NSSAIConfig>(); + Mockito.doReturn(configMap).when(rANSliceConfigService).findSliceConfig(Mockito.anyString()); + assertEquals(configMap, rANSliceConfigService.findSliceConfig(sNSSAI)); + } + + @Test + public void testFindDUsofSNssai() { + String sNSSAI = "001-00001"; + List<GNBDUModel> duModels = new ArrayList<GNBDUModel>(); + Mockito.doReturn(duModels).when(rANSliceConfigService).findDUsofSNssai(Mockito.anyString()); + assertEquals(duModels, rANSliceConfigService.findDUsofSNssai(sNSSAI)); + } + + @Test + public void testFindCUsofSNssai() { + String sNSSAI = "001-00001"; + List<GNBCUCPModel> cuModels = new ArrayList<GNBCUCPModel>(); + Mockito.doReturn(cuModels).when(rANSliceConfigService).findCUsofSNssai(Mockito.anyString()); + assertEquals(cuModels, rANSliceConfigService.findCUsofSNssai(sNSSAI)); + } + + @Test + public void testGetSubscriberDetails() { + String sNSSAI = "001-00001"; + Map<String, String> details = new HashMap<String, String>(); + Mockito.doReturn(details).when(rANSliceConfigService).getSubscriberDetails(Mockito.anyString()); + assertEquals(details, rANSliceConfigService.getSubscriberDetails(sNSSAI)); + } + + @Test + public void testFindAllCUCPFunctions() { + List<GNBCUCPModel> cucpModels = new ArrayList<GNBCUCPModel>(); + Mockito.doReturn(cucpModels).when(rANSliceConfigService).findAllCUCPFunctions(); + assertEquals(cucpModels, rANSliceConfigService.findAllCUCPFunctions()); + } + + @Test + public void testFindAllDUFunctions() { + List<GNBDUModel> duModels = new ArrayList<GNBDUModel>(); + Mockito.doReturn(duModels).when(rANSliceConfigService).findAllDUFunctions(); + assertEquals(duModels, rANSliceConfigService.findAllDUFunctions()); + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/resources/hibernate.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/test/resources/hibernate.properties deleted file mode 100644 index 7d6e456..0000000 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/test/resources/hibernate.properties +++ /dev/null @@ -1,20 +0,0 @@ -hibernate.dialect org.hibernate.dialect.H2Dialect -hibernate.connection.driver_class org.h2.Driver -hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1 -hibernate.connection.username sa - -hibernate.connection.pool_size 5 - -hibernate.show_sql false -hibernate.format_sql true - -hibernate.max_fetch_depth 5 - -hibernate.cache.region_prefix hibernate.test -hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory - -hibernate.jdbc.batch_versioned_data true - -javax.persistence.validation.mode=NONE -hibernate.service.allow_crawling=false -hibernate.session.events.log=true diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html index aba0ad6..ec9bc60 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/AdditionalFeature.html @@ -21,7 +21,7 @@ <!DOCTYPE html> <html> <head> -<title>Cell Operations History</title> +<title>Netconf server details</title> <style> table, td, th { border: solid 1px #DDD; @@ -45,7 +45,7 @@ table, td, th { </head> <body onload="getOperationLogs()"> <center> - <h3>Cell Operations History</h3> + <h3>Netconf server details</h3> </center> <br> <p id="showData"></p> @@ -54,94 +54,83 @@ table, td, th { </body> <script> - function getOperationLogs() { - var xmlhttp = new XMLHttpRequest(); - xmlhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - var logs = JSON.parse(this.responseText); - var myJSON = JSON.stringify(logs); - console.log(myJSON); - drawTable(logs); - } - }; - xmlhttp.open("GET","/ransim/api/GetNetconfStatus", - true); - xmlhttp.send(); - } + function getOperationLogs() { + var xmlhttp = new XMLHttpRequest(); + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + var logs = JSON.parse(this.responseText); + var myJSON = JSON.stringify(logs); + console.log(myJSON); + drawTable(logs); + } + }; + xmlhttp.open("GET", "/ransim/api/GetNetconfStatus", true); + xmlhttp.send(); + } - function drawTable(myBooks) { - // EXTRACT VALUE FOR HTML HEADER. - var col = []; - for (var i = 0; i < myBooks.length; i++) { - console.log(myBooks[i]); - for (var key in myBooks[i]) { - if (col.indexOf(key) === -1) { - col.push(key); - } - } - } - - console.log(col); + function drawTable(data) { + // EXTRACT VALUE FOR HTML HEADER. + var col = []; + for (var i = 0; i < data.length; i++) { + console.log(data[i]); + for ( var key in data[i]) { + if (col.indexOf(key) === -1) { + col.push(key); + } + } + } - // CREATE DYNAMIC TABLE. - var table = document.createElement("table"); + console.log(col); - // CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE. + // CREATE DYNAMIC TABLE. + var table = document.createElement("table"); - var tr = table.insertRow(-1); // TABLE ROW. + // CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE. - //for (var i = 0; i < 4; i++) { - for (var i = 0; i < col.length; i++) { - - // if (i == 0) continue; - var th = document.createElement("th"); // TABLE HEADER. - if(i==2) - th.innerHTML = "PORT"; - else - th.innerHTML = col[i].toUpperCase(); - //console.log("th.style " + th.style); - tr.appendChild(th); - } + var tr = table.insertRow(-1); // TABLE ROW. - // ADD JSON DATA TO THE TABLE AS ROWS. - for (var i = 0; i < myBooks.length; i++) { + for (var i = 0; i < col.length; i++) { - tr = table.insertRow(-1); - //manipulate rows - if(i % 2 == 0){ - tr.className = "even"; - }else{ - tr.className = "odd"; - } + var th = document.createElement("th"); // TABLE HEADER. + if (i == 2) + th.innerHTML = "PORT"; + else + th.innerHTML = col[i].toUpperCase(); + tr.appendChild(th); + } - //for (var j = 0; j < 4; j++) { - for (var j = 0; j < col.length; j++) { - - //if (j == 0) continue; - var tabCell = tr.insertCell(-1); - //tabCell.style.setWidth("25%"); - //console.log("tabCell.style " + tabCell.style); - if(j==3) - { - var arr = ""; - for(var k = 0;k<myBooks[i][col[j]].length;k++) - { - console.log("nodeId" + myBooks[i][col[j]][k]["nodeId"]); - arr = arr + " " + myBooks[i][col[j]][k]["nodeId"]; - } - tabCell.innerHTML = arr; - tabCell.className = "WID"; - console.log("arr" + arr); - } - else - tabCell.innerHTML = myBooks[i][col[j]]; - console.log("checking my books , j " + j + " " + myBooks[i][col[j]]); - } - } - // FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER. - var divContainer = document.getElementById("showData"); - divContainer.innerHTML = ""; - divContainer.appendChild(table); - } + // ADD JSON DATA TO THE TABLE AS ROWS. + for (var i = 0; i < data.length; i++) { + + tr = table.insertRow(-1); + //manipulate rows + if (i % 2 == 0) { + tr.className = "even"; + } else { + tr.className = "odd"; + } + + for (var j = 0; j < col.length; j++) { + + var tabCell = tr.insertCell(-1); + if (j == 3) { + var arr = ""; + for (var k = 0; k < data[i][col[j]].length; k++) { + console.log("nodeId" + data[i][col[j]][k]["nodeId"]); + arr = arr + " " + data[i][col[j]][k]["nodeId"]; + } + tabCell.innerHTML = arr; + tabCell.className = "WID"; + console.log("arr" + arr); + } else + tabCell.innerHTML = data[i][col[j]]; + console.log("checking data , j " + j + " " + data[i][col[j]]); + } + } + // FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER. + var divContainer = document.getElementById("showData"); + divContainer.innerHTML = ""; + divContainer.appendChild(table); + } </script> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationStop.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationStop.html index 3284ee2..edbf382 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationStop.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationStop.html @@ -20,46 +20,46 @@ --> <html> - <head> - <title>Simulator Configuration</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body> - <center> - <h2>Simulator Configuration</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td> - Do you really want to stop the Simulation and clear the Simulated data? - </td> - </tr> - <tr> - <td align=right> - <button ng-click="stopSimulation()">Yes</button> - <button ng-click = "close()">No</button> - </td> - </tr> - </table> - </form> - </div> - <script> +<head> +<title>Simulator Configuration</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Simulator Configuration</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Do you really want to stop the Simulation and clear the + Simulated data?</td> + </tr> + <tr> + <td align=right> + <button ng-click="stopSimulation()">Yes</button> + <button ng-click="close()">No</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', function($scope, $http) { $scope.stopSimulation = function(){ @@ -85,6 +85,7 @@ window.close(); } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html index 1193a7c..6fb1299 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTrigger.html @@ -20,66 +20,76 @@ --> <html> - <head> - <title>Simulator Configuration</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body><center> - <h2>Simulator Configuration</h2> - <div align="center" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate > - <table border = "0" align=center> - <tr> - <td>Cluster Level::</td> - <td><input name = "clusterLevel" type = "number" ng-model = "configui.clusterLevel" required> - <br><span style = "color:red" ng-show = "configForm.clusterLevel.$dirty && configForm.clusterLevel.$invalid"> - <span ng-show = "configForm.clusterLevel.$error.required">Cluster Level is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td>Grid Size:</td> - <td><input name = "gridSize" type = "number" ng-model = "configui.gridSize" required> - <br><span style = "color:red" ng-show = "configForm.gridSize.$dirty && configForm.gridSize.$invalid"> - <span ng-show = "configForm.gridSize.$error.required">Grid Size is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td>No. of Clusters: </td><td><input name = "numberOfClusters" type = "number" ng-model = "configui.numberOfClusters" required> - <br><span style = "color:red" ng-show = "configForm.numberOfClusters.$dirty && configForm.numberOfClusters.$invalid"> - <span ng-show = "configForm.numberOfClusters.$error.required">No. of Clusters is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td colspan=2 align=right> - <button ng-model = "configure" ng-disabled = "configForm.clusterLevel.$dirty && +<head> +<title>Simulator Configuration</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Simulator Configuration</h2> + <div align="center" ng-app="mainApp" ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Cluster Level::</td> + <td><input name="clusterLevel" type="number" + ng-model="configui.clusterLevel" required> <br> + <span style="color: red" + ng-show="configForm.clusterLevel.$dirty && configForm.clusterLevel.$invalid"> + <span ng-show="configForm.clusterLevel.$error.required">Cluster + Level is mandatory.</span> + </span></td> + </tr> + <tr> + <td>Grid Size:</td> + <td><input name="gridSize" type="number" + ng-model="configui.gridSize" required> <br> + <span style="color: red" + ng-show="configForm.gridSize.$dirty && configForm.gridSize.$invalid"> + <span ng-show="configForm.gridSize.$error.required">Grid + Size is mandatory.</span> + </span></td> + </tr> + <tr> + <td>No. of Clusters:</td> + <td><input name="numberOfClusters" type="number" + ng-model="configui.numberOfClusters" required> <br> + <span style="color: red" + ng-show="configForm.numberOfClusters.$dirty && configForm.numberOfClusters.$invalid"> + <span ng-show="configForm.numberOfClusters.$error.required">No. + of Clusters is mandatory.</span> + </span></td> + </tr> + <tr> + <td colspan=2 align=right> + <button ng-model="configure" + ng-disabled="configForm.clusterLevel.$dirty && configForm.clusterLevel.$invalid || configForm.gridSize.$dirty && configForm.gridSize.$invalid || configForm.numberOfClusters.$dirty && - configForm.configui.numberOfClusters.$invalid" ng-click="triggerSimulatorConfig()">Configure</button> - <button ng-model = "close" ng-click = "close()">Close</button> - </td> - </tr> - </table> - </form> - </div> - <script> + configForm.configui.numberOfClusters.$invalid" + ng-click="triggerSimulatorConfig()">Configure</button> + <button ng-model="close" ng-click="close()">Close</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', function($scope, $http) { $scope.triggerSimulatorConfig = function(){ @@ -104,6 +114,7 @@ window.close(); } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTriggerFile.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTriggerFile.html index 6a55bcf..e3872a8 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTriggerFile.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/SimulationTriggerFile.html @@ -20,47 +20,53 @@ --> <html> - <head> - <title>Simulator Configuration</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body><center> - <h2>Simulator Configuration</h2> - <div align="center" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate > - Using dump file to load simulation data. - <br> - <table border = "0" align=center> - <tr> - <td colspan=2 align=right> - <button ng-model = "configure" ng-click="triggerSimulatorConfig()">Configure</button> - <button ng-model = "close" ng-click = "close()">Close</button> - </td> - </tr> - </table> - </form> - </div> - <script> +<head> +<title>Simulator Configuration</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Simulator Configuration</h2> + <div align="center" data-ng-init="onloadFun()" ng-app="mainApp" ng-controller="configController"> + <form name="configForm" novalidate> + Using dump file to load simulation data. <br><br> + <select ng-required="required" ng-model="dumpfile" ng-options="x for x in files" required="required"> + <option value="" selected="selected" disabled="disabled">select dump file</option> + </select> + <br> + <br> + <table border="0" align=center> + <tr> + <td colspan=2 align=right> + <button ng-model="configure" ng-click="triggerSimulatorConfig()">Configure</button> + <button ng-model="close" ng-click="close()">Close</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', function($scope, $http) { $scope.triggerSimulatorConfig = function(){ - - var res = $http.post('/ransim/api/StartSimulation') + var files = { "dumpfile" :$scope.dumpfile} + var obj= JSON.stringify(files);; + var res = $http.post('/ransim/api/StartSimulation',obj) .then(function successCallback(response){ alert( "Simulation successfully triggered"); window.close(); @@ -69,11 +75,24 @@ window.close(); }); - }; + }; + + $scope.onloadFun=function() { + var xmlhttp = new XMLHttpRequest(); + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + var files = JSON.parse(this.responseText); + $scope.files =files; + } + }; + xmlhttp.open("GET", "/ransim/file/dumpfiles", false); + xmlhttp.send(); + }; $scope.close = function(){ window.close(); } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/controlpanel.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/controlpanel.html index a2cfabe..2f34b67 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/controlpanel.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/controlpanel.html @@ -21,19 +21,16 @@ <!DOCTYPE html> <html ng-app="myApp" ng-controller="myCtrl"> - <head> - <script src="angular.min.js"></script> - <style> - .can { - padding-top:40px; - } - </style> - <script> +<head> +<script src="angular.min.js"></script> +<style> +.can { + padding-top: 40px; +} +</style> +<script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope, $window) { - /*$scope.startSimulator = function() { - $window.open('SimulationTrigger.html', '','menubar=no, locationbar=no, toolbar=no, width=600px, height=250px'); - };*/ $scope.startSimulatorFile = function() { document.getElementById("stopSimulator").disabled = false; document.getElementById("startSimulator").disabled = true; @@ -56,25 +53,6 @@ document.getElementById("stopPm").disabled = false; document.getElementById("startPm").disabled = true; $window.open('startsPm.html', '','menubar=no, locationbar=no, toolbar=no, width=600px, height=400px'); - /* - var status; - var xmlhttp = new XMLHttpRequest(); - xmlhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - status = JSON.parse(this.responseText); - console.log(status); - console.log("status"); - } - }; - xmlhttp.open("GET", "/ransim/api/GetPmDataStatus", - true); - xmlhttp.send(); - - if(status == true){ - document.getElementById("stopPm").disabled = false; - document.getElementById("startPm").disabled = true; - }*/ - }; $scope.stopPm = function() { document.getElementById("stopPm").disabled = true; @@ -82,36 +60,36 @@ $window.open('stopPm.html', '','menubar=no, locationbar=no, toolbar=no, width=600px, height=250px'); }; - + $scope.uploadFile = function() { + $window.open('uploadFile.html', '','menubar=no, locationbar=no, toolbar=no, width=600px, height=250px'); + } }); </script> - </head> - <body> +</head> +<body> <div id="controlpanel" class="absolute"> - RAN Simulation - <br> + RAN Simulation <br> <!-- button ng-click="startSimulator()">StartHoneycomb</button--> <button id="startSimulator" ng-click="startSimulatorFile()">Start</button> - <button id="stopSimulator" ng-click="stopSimulator()" disabled>Stop</button><br> - <br> - <div id="operupdate" name="operuodate">Click view to check details of the updated cells</div> + <button id="stopSimulator" ng-click="stopSimulator()" disabled>Stop</button> + <br> <br> + <button id="uploadFile" ng-click="uploadFile()">Upload Dump File</button> + <br><br> + <div id="operupdate" name="operuodate">Click view to check + details of the updated cells</div> <button ng-click="showOperationTable()">View</button> - <br> - <br> + <br> <br> <button ng-click="showNetconfServerDetails()">Netconf Details</button> - <br> - <br> + <br> <br> <div>PM data</div> <button id="startPm" ng-click="startPm()">Start</button> <button id="stopPm" ng-click="stopPm()" disabled>Stop</button> - <br> - <br> - + <br> <br> </div> - <p></p> - <canvas id="Canvas2" class="can" width="4000" height="10000"></canvas> - </body> + <p></p> + <canvas id="Canvas2" class="can" width="4000" height="10000"></canvas> +</body> <script> var canvas = document.getElementById('Canvas2'); var ctx = canvas.getContext('2d'); diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/deleteCell.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/deleteCell.html index 1d0406c..7860485 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/deleteCell.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/deleteCell.html @@ -21,91 +21,69 @@ <html> <head> - <title>Delete Cell Configuration</title> - <script src="angular.min.js"></script> - <style> - table, - th, - td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> +<title>Delete Cell Configuration</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> </head> <body> - <center> - <h2>Delete Cell Configuration</h2> - <div data-ng-init="onloadFun()" ng-app="mainApp" ng-controller="configController"> - <form name="configForm" novalidate> - <table border="0" align=center> - <tr> - <td> - <input name="nodeId" type="hidden" ng-model="nodeId" required disabled> Do you really want to delete the Cell {{nodeId}}? - </td> - </tr> - <tr> - <td align=right> - <button ng-disabled="configForm.nodeId.$dirty && - configForm.nodeId.$invalid" ng-click="deleteCell()">Delete</button> - <button ng-click="close()">Cancel</button> - </td> - </tr> - </table> - </form> - </div> - <script> + <center> + <h2>Delete Cell Configuration</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td><input name="nodeId" type="hidden" ng-model="nodeId" + required disabled> Do you really want to delete the Cell + {{nodeId}}?</td> + </tr> + <tr> + <td align=right> + <button + ng-disabled="configForm.nodeId.$dirty && + configForm.nodeId.$invalid" + ng-click="deleteCell()">Delete</button> + <button ng-click="close()">Cancel</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController', ['$scope', '$http', '$location', function($scope, $http, $location) { $scope.deleteCell = function() { - //alert($scope.nodeId); var formVal = { "nodeId": $scope.nodeId } var dataObj = JSON.stringify(formVal); - //alert("Delete DataObj : " + dataObj); var res = $http.post( '/ransim/api/DeleteACell', dataObj ) .then(function successCallback(response) { - //alert("Success message: " + JSON.stringify(response)); alert("Delete Successful"); window.close(); }, function errorCallback(response) { - //alert("Failure message: " + JSON.stringify(response)); alert("Delete Failed"); window.close(); }); - - /*var xmlhttp = new XMLHttpRequest(); - xmlhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - alert( "Success message: "+JSON.stringify(this.responseText)); - alert("deleted Successfully"); - window.close(); - } else if (this.readyState == 4 && this.status > 200) { - alert( "Failure message: "+JSON.stringify(this.responseText)); - alert("delete Failed"); - window.close(); - } - xmlhttp.open("POST", - "/ransim/api/DeleteACell", true); - xmlhttp.setRequestHeader('Content-Type', 'application/json') - xmlhttp.send(dataObj); - }; - */ - }; $scope.close = function() { window.close(); @@ -117,8 +95,7 @@ absUrl = $location.absUrl(), // extract and parse url elements = absUrl.split("?"); - - // parse quesry string + // parse query string parts["queryString"] = elements[1]; if (elements[1]) { parts["hashString"] = (parts["queryString"].split("#"))[1]; @@ -129,7 +106,6 @@ var __variable = queryStringVariable.split("="); parts.queryvars[__variable[0]] = __variable[1]; }); - //alert("Parts : "+JSON.stringify(parts)); if (parts.queryvars["cid"] !== "undefined") { alert("CID : " + parts.queryvars["cid"]); $scope.nodeId = parts.queryvars["cid"]; @@ -139,7 +115,7 @@ } ]); </script> - <center> + <center> </body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html index 9c8ab7b..9e52eb2 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/displayCellDetails.html @@ -20,82 +20,57 @@ --> <html> - <head> - <title>Display Cell Details</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body><center> - <h2>Cell Details</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td>Node Id:</td> - <td><input name = "nodeId" type = "string" ng-model = "nodeId" required disabled> - <br><span style = "color:red" ng-show = "configForm.nodeId.$dirty && configForm.nodeId.$invalid"> - <span ng-show = "configForm.nodeId.$error.required">Node Id is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td>Physical Cell Id:</td> - <td><input name = "oldPhysicalCellId" type = "number" ng-model = "oldPhysicalCellId" required disabled> - <br> - </td> - </tr> - <tr> - <td>Pnf Name:</td> - <td><input name = "pnfName" type = "string" ng-model = "pnfName" required disabled> - <br> - </td> - </tr> - <!-- tr> - <td>New Physical Cell Id:</td> - <td><input name = "newPhysicalCellId" type = "number" ng-model = "newPhysicalCellId" required> - <br><span style = "color:red" ng-show = "configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid"> - <span ng-show = "configForm.newPhysicalCellId.$error.required">New Physical Cell Id is mandatory.</span> - </span> - </td> - </tr --> - <!-- tr> - <td>Neighbors:</td> - <td><textarea name = "existingNbrs" rows="8" cols="31" type = "string" ng-model = "existingNbrs" disabled></textarea> - <br> - </td> - </tr --> - <!-- tr> - <td>New Neighbors:</td> - <td><textarea name = "newNbrs" rows="8" cols="31" type = "string" ng-model = "newNbrs"></textarea> - <br> - </td> - </tr --> - <!-- tr> - <td colspan=2 align=right> - <button ng-disabled = "configForm.newPhysicalCellId.$dirty && - configForm.newPhysicalCellId.$invalid || configForm.nodeId.$dirty && - configForm.nodeId.$invalid" ng-click="modifyCell()">Modify</button> - <button ng-click = "close()">Cancel</button> - </td> - </tr --> - </table> - </form> - </div> - <script> +<head> +<title>Display Cell Details</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Cell Details</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Node Id:</td> + <td><input name="nodeId" type="string" ng-model="nodeId" + required disabled> <br> + <span style="color: red" + ng-show="configForm.nodeId.$dirty && configForm.nodeId.$invalid"> + <span ng-show="configForm.nodeId.$error.required">Node Id + is mandatory.</span> + </span></td> + </tr> + <tr> + <td>Physical Cell Id:</td> + <td><input name="oldPhysicalCellId" type="number" + ng-model="oldPhysicalCellId" required disabled> <br> + </td> + </tr> + <tr> + <td>Pnf Name:</td> + <td><input name="pnfName" type="string" ng-model="pnfName" + required disabled> <br></td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', '$location', function($scope, $http, $location) { $scope.modifyCell = function() { @@ -120,27 +95,22 @@ var __variable = queryStringVariable.split("="); parts.queryvars[__variable[0]] = __variable[1]; }); - //alert("Parts : "+JSON.stringify(parts)); if (parts.queryvars["cid"] !== "undefined") { //alert("CID : "+parts.queryvars["cid"]); $scope.nodeId = parts.queryvars["cid"]; } if (parts.queryvars["pcid"] !== "undefined") { - //alert("PC Id : "+parts.queryvars["pcid"]); $scope.newPhysicalCellId = parseInt(parts.queryvars["pcid"]); $scope.oldPhysicalCellId = parseInt(parts.queryvars["pcid"]); } if (parts.queryvars["pnf"] !== "undefined") { - //alert("CID : "+parts.queryvars["cid"]); $scope.pnfName = parts.queryvars["pnf"]; } - //neighbrList - //neighbrList=Chn204%2CChn203%2CChn403%2CChn302%2CChn304%2CChn202 - } } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html index b878d65..86eae42 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/getdump.html @@ -23,49 +23,59 @@ <html> <head> - <script src="angular.min.js"></script> - <style> - .show { - z-index: 1000; - position: absolute; - padding: 2px; - display: block; - margin: 0; - list-style-type: none; - list-style: none; - } - - .hide { - display: none; - } - - .btn-group .button { - background-color: LightGrey; - color: black; - border: 1px solid Black; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; - cursor: pointer; - width: 100px; - display: block; - } - - .btn-group .button:not (:last-child) { - border-bottom: - - none; - +<script src="angular.min.js"></script> +<style> +.show { + z-index: 1000; + position: absolute; + padding: 2px; + display: block; + margin: 0; + list-style-type: none; + list-style: none; +} + +.hide { + display: none; +} + +.btn-group .button { + background-color: LightGrey; + color: black; + border: 1px solid Black; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + cursor: pointer; + width: 100px; + display: block; +} + +.btn-group + +.button +:not + +( +:last-child + +) +{ +border-bottom +: + +none +; - } - .btn-group .button:hover { - background-color: lightblue; - color: white; - } - </style> - <script> +} +.btn-group .button:hover { + background-color: lightblue; + color: white; +} +</style> +<script> function init() { getCellTopology(); } @@ -75,13 +85,11 @@ "nodeId": nodeId } var dataObj = JSON.stringify(formVal); - //console.log("Delete DataObj : " + dataObj); var xmlhttp = new XMLHttpRequest(); var toBeContinued = true; var nbrsStr = ''; xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { - //console.log("Response DataObj : " + this.responseText); var nbrs = JSON.parse(this.responseText); for( i in nbrs.cellsWithHO ) { var nodeId = nbrs.cellsWithHO[i].nodeId; @@ -89,7 +97,6 @@ nbrsStr += ', '; nbrsStr += '{"nodeId":'+'"'+nodeId+'"'+',"blacklisted":"false"}' ; } - //console.log("Response nbrsStr : " + nbrsStr); toBeContinued = false; } else if (this.readyState == 4 && this.status >= 200) { toBeContinued = false; @@ -144,81 +151,6 @@ var aColors = "#32CD32"; var aColorsLength = 1; var arr = new Array(); - /* for (var x = 0; x < gridSize; x++) { - arr[x] = new Array(); - for (var y = 0; y < gridSize; y++) { - - context.fillStyle = "#D3D3D3"; - - context.beginPath(); - - context.lineWidth = 5; - var a = 1.5 * rad; - var b = 0.86 * rad; - if (x % 2 == 0) { - context.moveTo((x + 1) * a + rad, (2 * y + 1) * b); - var s = 6; - for (var p = 1; p < s; p++) { - context.lineTo(((x + 1) * a) + (rad * Math.cos(p * - 2 * Math.PI / s)), (2 * y + 1) * b + ( - rad * Math.sin(p * 2 * Math.PI / s))); - } - } else { - - context.moveTo((x + 1) * a + rad, (2 * y + 2) * b); - var s = 6; - for (var p = 1; p < s; p++) { - context.lineTo(((x + 1) * a) + (rad * Math.cos(p * - 2 * Math.PI / s)), ((2 * y + 2) * b) + - ( - rad * Math.sin(p * 2 * Math.PI / s))); - } - } - context.strokeStyle = "black"; - context.stroke(); - - context.closePath(); - context.fill(); - arr[x][y] = (x + 1) + ":" + (y + 1); - } - } */ - - /* myCanvas.addEventListener('contextmenu', (e) => { - const pos = { - x: e.clientX, - y: e.clientY - }; - for (var x = 0; x < gridSize; x++) { - for (var y = 0; y < gridSize; y++) { - if (isIntersectDefault(pos, x, y, rad, gaps)) { - var val = arr[x][y]; - document.getElementById("rmenu").className = - "show"; - document.getElementById('rmenu').style.top = - pos.y + "px"; //or whatever - document.getElementById('rmenu').style.left = - pos.x + "px"; // or whatever - - var htmlText1 = '<div class="btn-group">'; - htmlText1 += - '<button class="button" id="createNode">Create</button>'; - htmlText1 += '</div>'; - document.getElementById("rmenu").innerHTML = - htmlText1; - - document.getElementById("createNode").addEventListener( - "click", - function() { - createNode(val); - }); - e.preventDefault(); - return; - } - } - } - e.preventDefault(); - }); */ - console.log('{ "cellList" :['); var index = 0; var pnfNum = 1000; @@ -233,8 +165,6 @@ var row = i/45; var col = i%45; - - //function point2LatLng(row, col, map); //console.log( translate_coordinates(row, row)); @@ -259,8 +189,6 @@ if (typeof topoObj.cellTopology[i].color != 'undefined') { confuColor = topoObj.cellTopology[i].color; } - //alert(nodeId+" "+physicalCellId+" "+col+" "+row+" "+confusion+" "+confuColor+" "); - if (collision) { if (confusion) { context.fillStyle = "#FF0000"; @@ -298,14 +226,12 @@ } context.strokeStyle = "black"; context.stroke(); - //alert(nodeId+" Circle X " + (rad+gaps*col) + " Y: "+ (rad+gaps*row)); context.closePath(); context.fill(); context.font = "12px Comic Sans MS"; context.fillStyle = "white"; context.textAlign = "center"; - //fillMultiLineText(context,"cid:"+nodeId+"\npcid:"+physicalCellId, rad+gaps*col,rad+ gaps*row); if (col % 2 == 0) { context.fillText("" + nodeId + "," + physicalCellId, (col +1) * a, rad + (2 * row + 1) * b); @@ -313,20 +239,12 @@ var xy2ll = translate_xyToLatLng( (col +1) * a, (2 * row +1) * b); var slat=xy2ll.slat; var slon=xy2ll.slon; - //cellStr += ' "latitude" : "' + slat + '", '; - //cellStr += ' "longitude" : "' + slon + '" '; - - //cellStr += ' "screenX" : "' + ((col + 1) * a) + '", '; - //cellStr += ' "screenY" : "' + (rad + (2 * row) * b) + '" '; + } else { context.fillText("" + nodeId + "," + physicalCellId, (col +1) * a, (2 * row + 2) * b); var xy2ll = translate_xyToLatLng( (col +1) * a, (2 * row + 2) * b); var slat=xy2ll.slat; var slon=xy2ll.slon; - //cellStr += ' "latitude" : "' + slat + '", '; - //cellStr += ' "longitude" : "' + slon + '" '; - //cellStr += ' "screenX" : "' + ((col + 1) * a) + '", '; - //cellStr += ' "screenY" : "' + ((2 * row + 2) * b) + '" '; } var neighborStr = getNeighborDumb(nodeId); @@ -375,8 +293,6 @@ gaps)) { var nodeVal = topoObj.cellTopology[i].nodeId; var cellVal = topoObj.cellTopology[i].physicalCellId; - //alert('click on circle: ' + topoObj.cellTopology[i].nodeId); - //alert(pos.x + " "+pos.y); document.getElementById("rmenu").className = "show"; document.getElementById('rmenu').style.top = @@ -439,13 +355,6 @@ var xx,yy,r,ct,st,angle; angle = 0; - - - /* X,Y to Lat/Lon Coordinate Translation */ - //pxpos_mtrs = porg.x; - //pypos_mtrs = porg.y; - //xx = x; - // yy = y; r = Math.sqrt(xx*xx + yy*yy); if(r) @@ -475,9 +384,6 @@ r = Math.sqrt(xx*xx + yy*yy); - /* alert('LL_TO_XY: xx=' + xx + ' yy=' + yy + ' r=' + r); - return false;*/ - if(r) { ct = xx/r; @@ -485,9 +391,6 @@ xx = r * ( (ct * Math.cos(0)) + (st * Math.sin(0)) ); yy = r * ( (st * Math.cos(0)) - (ct * Math.sin(0)) ); } - //pxpos_mtrs = xx + porg.xoffset_mtrs; - //pypos_mtrs = yy + porg.yoffset_mtrs; - var sxy={}; sxy={x:xx, y:yy}; @@ -498,7 +401,6 @@ var point = cellInfo.split(":"); var gridX = point[0]; var gridY = point[1]; - //alert("Cell X : "+gridX+" Y: "+ gridY); window.childWin = window.open('createCell.html?gridX=' + gridX + '&gridY=' + gridY, '', 'menubar=no, locationbar=no, toolbar=no, width=600px, height=250px' @@ -518,7 +420,6 @@ } function deleteNode(cid, pcid) { - //alert("Delete CID "+cid + " PCID " + pcid); window.childWin = window.open('deleteCell.html?cid=' + cid + '&pcid=' + pcid, '', 'menubar=no, locationbar=no, toolbar=no, width=600px, height=250px' @@ -591,8 +492,8 @@ </head> <body onLoad="init();" style="margin: 0px"> - <div class="hide" id="rmenu"></div> - <canvas id="myCanvas" /> + <div class="hide" id="rmenu"></div> + <canvas id="myCanvas" /> </body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/honeycomb.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/honeycomb.html index e40a722..e89fa9f 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/honeycomb.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/honeycomb.html @@ -23,49 +23,45 @@ <html> <head> - <script src="angular.min.js"></script> - <style> - .show { - z-index: 1000; - position: absolute; - padding: 2px; - display: block; - margin: 0; - list-style-type: none; - list-style: none; - } - - .hide { - display: none; - } - - .btn-group .button { - background-color: LightGrey; - color: black; - border: 1px solid Black; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; - cursor: pointer; - width: 100px; - display: block; - } - - .btn-group .button:not (:last-child) { - border-bottom: - - none; - - - } - - .btn-group .button:hover { - background-color: lightblue; - color: white; - } - </style> - <script> +<script src="angular.min.js"></script> +<style> +.show { + z-index: 1000; + position: absolute; + padding: 2px; + display: block; + margin: 0; + list-style-type: none; + list-style: none; +} + +.hide { + display: none; +} + +.btn-group .button { + background-color: LightGrey; + color: black; + border: 1px solid Black; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + cursor: pointer; + width: 100px; + display: block; +} + +.btn-group .button:not (:last-child ) { + border-bottom: none; +} + +.btn-group .button:hover { + background-color: lightblue; + color: white; +} +</style> +<script> document.body.addEventListener("wheel", e=>{ if(e.ctrlKey) event.preventDefault();//prevent zoom @@ -202,8 +198,6 @@ if (typeof topoObj.cellTopology[i].color != 'undefined') { confuColor = topoObj.cellTopology[i].color; } - //alert(nodeId+" "+physicalCellId+" "+col+" "+row+" "+confusion+" "+confuColor+" "); - if (collision) { if (confusion) { context.fillStyle = "#FF0000"; @@ -240,14 +234,12 @@ } context.strokeStyle = "black"; context.stroke(); - //alert(nodeId+" Circle X " + (rad+gaps*col) + " Y: "+ (rad+gaps*row)); context.closePath(); context.fill(); context.font = "12px Comic Sans MS"; context.fillStyle = "white"; context.textAlign = "center"; - //fillMultiLineText(context,"cid:"+nodeId+"\npcid:"+physicalCellId, rad+gaps*col,rad+ gaps*row); if (col % 2 == 0) { context.fillText("" + nodeId + "," + physicalCellId, (col + @@ -292,8 +284,6 @@ gaps)) { var nodeVal = topoObj.cellTopology[i].nodeId; var cellVal = topoObj.cellTopology[i].physicalCellId; - //alert('click on circle: ' + topoObj.cellTopology[i].nodeId); - //alert(pos.x + " "+pos.y); document.getElementById("rmenu").className = "show"; document.getElementById('rmenu').style.top = @@ -332,7 +322,6 @@ var point = cellInfo.split(":"); var gridX = point[0]; var gridY = point[1]; - //alert("Cell X : "+gridX+" Y: "+ gridY); window.childWin = window.open('createCell.html?gridX=' + gridX + '&gridY=' + gridY, '', 'menubar=no, locationbar=no, toolbar=no, width=600px, height=250px' @@ -342,7 +331,6 @@ } function modifyNode(cid, pcid) { - //alert("Modify CID "+cid + " PCID " + pcid); window.childWin = window.open('modifyCell.html?cid=' + cid + '&pcid=' + pcid, '', 'menubar=no, locationbar=no, toolbar=no, width=600px, height=250px' @@ -352,7 +340,6 @@ } function deleteNode(cid, pcid) { - //alert("Delete CID "+cid + " PCID " + pcid); window.childWin = window.open('deleteCell.html?cid=' + cid + '&pcid=' + pcid, '', 'menubar=no, locationbar=no, toolbar=no, width=600px, height=250px' @@ -425,8 +412,8 @@ </head> <body onLoad="init();" style="margin: 0px"> - <div class="hide" id="rmenu"></div> - <canvas id="myCanvas" /> + <div class="hide" id="rmenu"></div> + <canvas id="myCanvas" /> </body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCell.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCell.html index 4862475..c64de04 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCell.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCell.html @@ -20,76 +20,73 @@ --> <html> - <head> - <title>Modify Cell Configuration</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body><center> - <h2>Modify Cell Configuration</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td>Node Id:</td> - <td><input name = "nodeId" type = "string" ng-model = "nodeId" required disabled> - <br><span style = "color:red" ng-show = "configForm.nodeId.$dirty && configForm.nodeId.$invalid"> - <span ng-show = "configForm.nodeId.$error.required">Node Id is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td>Physical Cell Id:</td> - <td><input name = "oldPhysicalCellId" type = "number" ng-model = "oldPhysicalCellId" required disabled> - <br> - </td> - </tr> - <!-- tr> - <td>New Physical Cell Id:</td> - <td><input name = "newPhysicalCellId" type = "number" ng-model = "newPhysicalCellId" required> - <br><span style = "color:red" ng-show = "configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid"> - <span ng-show = "configForm.newPhysicalCellId.$error.required">New Physical Cell Id is mandatory.</span> - </span> - </td> - </tr --> - <tr> - <td>Existing Neighbors:</td> - <td><textarea name = "existingNbrs" rows="8" cols="31" type = "string" ng-model = "existingNbrs" disabled></textarea> - <br> - </td> - </tr> - <tr> - <td>New Neighbors:</td> - <td><textarea name = "newNbrs" rows="8" cols="31" type = "string" ng-model = "newNbrs"></textarea> - <br> - </td> - </tr> - <tr> - <td colspan=2 align=right> - <button ng-disabled = "configForm.newPhysicalCellId.$dirty && +<head> +<title>Modify Cell Configuration</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Modify Cell Configuration</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Node Id:</td> + <td><input name="nodeId" type="string" ng-model="nodeId" + required disabled> <br> + <span style="color: red" + ng-show="configForm.nodeId.$dirty && configForm.nodeId.$invalid"> + <span ng-show="configForm.nodeId.$error.required">Node Id + is mandatory.</span> + </span></td> + </tr> + <tr> + <td>Physical Cell Id:</td> + <td><input name="oldPhysicalCellId" type="number" + ng-model="oldPhysicalCellId" required disabled> <br> + </td> + </tr> + <tr> + <td>Existing Neighbors:</td> + <td><textarea name="existingNbrs" rows="8" cols="31" + type="string" ng-model="existingNbrs" disabled></textarea> <br> + </td> + </tr> + <tr> + <td>New Neighbors:</td> + <td><textarea name="newNbrs" rows="8" cols="31" type="string" + ng-model="newNbrs"></textarea> <br></td> + </tr> + <tr> + <td colspan=2 align=right> + <button + ng-disabled="configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid || configForm.nodeId.$dirty && - configForm.nodeId.$invalid" ng-click="modifyCell()">Modify</button> - <button ng-click = "close()">Cancel</button> - </td> - </tr> - </table> - </form> - </div> - <script> + configForm.nodeId.$invalid" + ng-click="modifyCell()">Modify</button> + <button ng-click="close()">Cancel</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', '$location', function($scope, $http, $location) { $scope.modifyCell = function() { @@ -132,13 +129,10 @@ var __variable = queryStringVariable.split("="); parts.queryvars[__variable[0]] = __variable[1]; }); - //alert("Parts : "+JSON.stringify(parts)); if (parts.queryvars["cid"] !== "undefined") { - //alert("CID : "+parts.queryvars["cid"]); $scope.nodeId = parts.queryvars["cid"]; } if (parts.queryvars["pcid"] !== "undefined") { - //alert("PC Id : "+parts.queryvars["pcid"]); $scope.newPhysicalCellId = parseInt(parts.queryvars["pcid"]); $scope.oldPhysicalCellId = parseInt(parts.queryvars["pcid"]); } @@ -152,6 +146,7 @@ } } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCellPci.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCellPci.html index 41b61ca..1e93a99 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCellPci.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/modifyCellPci.html @@ -20,76 +20,78 @@ --> <html> - <head> - <title>Modify Cell Configuration</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body><center> - <h2>Modify Cell Configuration</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td>Node Id:</td> - <td><input name = "nodeId" type = "string" ng-model = "nodeId" required disabled> - <br><span style = "color:red" ng-show = "configForm.nodeId.$dirty && configForm.nodeId.$invalid"> - <span ng-show = "configForm.nodeId.$error.required">Node Id is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td>Physical Cell Id:</td> - <td><input name = "oldPhysicalCellId" type = "number" ng-model = "oldPhysicalCellId" required disabled> - <br> - </td> - </tr> - <tr> - <td>New Physical Cell Id:</td> - <td><input name = "newPhysicalCellId" type = "number" ng-model = "newPhysicalCellId" required> - <br><span style = "color:red" ng-show = "configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid"> - <span ng-show = "configForm.newPhysicalCellId.$error.required">New Physical Cell Id is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td>Existing Neighbors:</td> - <td><textarea name = "existingNbrs" rows="8" cols="31" type = "string" ng-model = "existingNbrs" disabled></textarea> - <br> - </td> - </tr> - <!-- tr> - <td>New Neighbors:</td> - <td><textarea name = "newNbrs" rows="8" cols="31" type = "string" ng-model = "newNbrs"></textarea> - <br> - </td> - </tr --> - <tr> - <td colspan=2 align=right> - <button ng-disabled = "configForm.newPhysicalCellId.$dirty && +<head> +<title>Modify Cell Configuration</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Modify Cell Configuration</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Node Id:</td> + <td><input name="nodeId" type="string" ng-model="nodeId" + required disabled> <br> + <span style="color: red" + ng-show="configForm.nodeId.$dirty && configForm.nodeId.$invalid"> + <span ng-show="configForm.nodeId.$error.required">Node Id + is mandatory.</span> + </span></td> + </tr> + <tr> + <td>Physical Cell Id:</td> + <td><input name="oldPhysicalCellId" type="number" + ng-model="oldPhysicalCellId" required disabled> <br> + </td> + </tr> + <tr> + <td>New Physical Cell Id:</td> + <td><input name="newPhysicalCellId" type="number" + ng-model="newPhysicalCellId" required> <br> + <span style="color: red" + ng-show="configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid"> + <span ng-show="configForm.newPhysicalCellId.$error.required">New + Physical Cell Id is mandatory.</span> + </span></td> + </tr> + <tr> + <td>Existing Neighbors:</td> + <td><textarea name="existingNbrs" rows="8" cols="31" + type="string" ng-model="existingNbrs" disabled></textarea> <br> + </td> + </tr> + <tr> + <td colspan=2 align=right> + <button + ng-disabled="configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid || configForm.nodeId.$dirty && - configForm.nodeId.$invalid" ng-click="modifyCell()">Modify</button> - <button ng-click = "close()">Cancel</button> - </td> - </tr> - </table> - </form> - </div> - <script> + configForm.nodeId.$invalid" + ng-click="modifyCell()">Modify</button> + <button ng-click="close()">Cancel</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', '$location', function($scope, $http, $location) { $scope.modifyCell = function() { @@ -132,13 +134,10 @@ var __variable = queryStringVariable.split("="); parts.queryvars[__variable[0]] = __variable[1]; }); - //alert("Parts : "+JSON.stringify(parts)); if (parts.queryvars["cid"] !== "undefined") { - //alert("CID : "+parts.queryvars["cid"]); $scope.nodeId = parts.queryvars["cid"]; } if (parts.queryvars["pcid"] !== "undefined") { - //alert("PC Id : "+parts.queryvars["pcid"]); $scope.newPhysicalCellId = parseInt(parts.queryvars["pcid"]); $scope.oldPhysicalCellId = parseInt(parts.queryvars["pcid"]); } @@ -152,6 +151,7 @@ } } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/newmodify.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/newmodify.html index 4862475..e2b2fac 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/newmodify.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/newmodify.html @@ -20,76 +20,73 @@ --> <html> - <head> - <title>Modify Cell Configuration</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body><center> - <h2>Modify Cell Configuration</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td>Node Id:</td> - <td><input name = "nodeId" type = "string" ng-model = "nodeId" required disabled> - <br><span style = "color:red" ng-show = "configForm.nodeId.$dirty && configForm.nodeId.$invalid"> - <span ng-show = "configForm.nodeId.$error.required">Node Id is mandatory.</span> - </span> - </td> - </tr> - <tr> - <td>Physical Cell Id:</td> - <td><input name = "oldPhysicalCellId" type = "number" ng-model = "oldPhysicalCellId" required disabled> - <br> - </td> - </tr> - <!-- tr> - <td>New Physical Cell Id:</td> - <td><input name = "newPhysicalCellId" type = "number" ng-model = "newPhysicalCellId" required> - <br><span style = "color:red" ng-show = "configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid"> - <span ng-show = "configForm.newPhysicalCellId.$error.required">New Physical Cell Id is mandatory.</span> - </span> - </td> - </tr --> - <tr> - <td>Existing Neighbors:</td> - <td><textarea name = "existingNbrs" rows="8" cols="31" type = "string" ng-model = "existingNbrs" disabled></textarea> - <br> - </td> - </tr> - <tr> - <td>New Neighbors:</td> - <td><textarea name = "newNbrs" rows="8" cols="31" type = "string" ng-model = "newNbrs"></textarea> - <br> - </td> - </tr> - <tr> - <td colspan=2 align=right> - <button ng-disabled = "configForm.newPhysicalCellId.$dirty && +<head> +<title>Modify Cell Configuration</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Modify Cell Configuration</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Node Id:</td> + <td><input name="nodeId" type="string" ng-model="nodeId" + required disabled> <br> + <span style="color: red" + ng-show="configForm.nodeId.$dirty && configForm.nodeId.$invalid"> + <span ng-show="configForm.nodeId.$error.required">Node Id + is mandatory.</span> + </span></td> + </tr> + <tr> + <td>Physical Cell Id:</td> + <td><input name="oldPhysicalCellId" type="number" + ng-model="oldPhysicalCellId" required disabled> <br> + </td> + </tr> + <tr> + <td>Existing Neighbors:</td> + <td><textarea name="existingNbrs" rows="8" cols="31" + type="string" ng-model="existingNbrs" disabled></textarea> <br> + </td> + </tr> + <tr> + <td>New Neighbors:</td> + <td><textarea name="newNbrs" rows="8" cols="31" type="string" + ng-model="newNbrs"></textarea> <br></td> + </tr> + <tr> + <td colspan=2 align=right> + <button + ng-disabled="configForm.newPhysicalCellId.$dirty && configForm.newPhysicalCellId.$invalid || configForm.nodeId.$dirty && - configForm.nodeId.$invalid" ng-click="modifyCell()">Modify</button> - <button ng-click = "close()">Cancel</button> - </td> - </tr> - </table> - </form> - </div> - <script> + configForm.nodeId.$invalid" + ng-click="modifyCell()">Modify</button> + <button ng-click="close()">Cancel</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', '$location', function($scope, $http, $location) { $scope.modifyCell = function() { @@ -104,11 +101,9 @@ var res = $http.post('/ransim/api/ModifyACell', dataObj) .then(function successCallback(response){ - alert("Modified Successfully"); window.close(); }, function errorCallback(response){ - alert("Modify Failed"); window.close(); }); @@ -132,13 +127,10 @@ var __variable = queryStringVariable.split("="); parts.queryvars[__variable[0]] = __variable[1]; }); - //alert("Parts : "+JSON.stringify(parts)); if (parts.queryvars["cid"] !== "undefined") { - //alert("CID : "+parts.queryvars["cid"]); $scope.nodeId = parts.queryvars["cid"]; } if (parts.queryvars["pcid"] !== "undefined") { - //alert("PC Id : "+parts.queryvars["pcid"]); $scope.newPhysicalCellId = parseInt(parts.queryvars["pcid"]); $scope.oldPhysicalCellId = parseInt(parts.queryvars["pcid"]); } @@ -152,6 +144,7 @@ } } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/operationhistory.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/operationhistory.html index 3b6ed37..8af0f8b 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/operationhistory.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/operationhistory.html @@ -21,29 +21,40 @@ <!DOCTYPE html> <html> <head> - <title>Cell Operations History</title> - <style> - th, td, p, input { - font:14px Verdana; - } - table, th, td - { - border: solid 1px #DDD; - border-collapse: collapse; - padding: 2px 3px; - text-align: center; - } - th { - font-weight:bold; - } - .odd{background-color: white;} - .even{background-color: gray;} - </style> +<title>Cell Operations History</title> +<style> +th, td, p, input { + font: 14px Verdana; +} + +table, th, td { + border: solid 1px #DDD; + border-collapse: collapse; + padding: 2px 3px; + text-align: center; +} + +th { + font-weight: bold; +} + +.odd { + background-color: white; +} + +.even { + background-color: gray; +} +</style> </head> <body onload="getOperationLogs()"> - <center><h3>Cell Operations History</h3></center><br> - <p id="showData"></p> - <input align=right type=button name=close value="Close" onclick="window.close();"> + <center> + <h3>Cell Operations History</h3> + </center> + <br> + <p id="showData"></p> + <input align=right type=button name=close value="Close" + onclick="window.close();"> </body> <script> @@ -62,13 +73,11 @@ xmlhttp.send(); } - function drawTable(myBooks) { + function drawTable(data) { // EXTRACT VALUE FOR HTML HEADER. - // ('Book ID', 'Book Name', 'Category' and 'Price') - //alert("Draw Table"); var col = []; - for (var i = 0; i < myBooks.length; i++) { - for (var key in myBooks[i]) { + for (var i = 0; i < data.length; i++) { + for (var key in data[i]) { if (col.indexOf(key) === -1) { col.push(key); } @@ -92,7 +101,7 @@ } // ADD JSON DATA TO THE TABLE AS ROWS. - for (var i = 0; i < myBooks.length; i++) { + for (var i = 0; i < data.length; i++) { tr = table.insertRow(-1); //manipulate rows @@ -108,10 +117,10 @@ if (j == 0) continue; var tabCell = tr.insertCell(-1); if (j==1) { - var d = new Date(myBooks[i][col[j]] + 19800000); + var d = new Date(data[i][col[j]] + 19800000); tabCell.innerHTML = d; } else { - tabCell.innerHTML = myBooks[i][col[j]]; + tabCell.innerHTML = data[i][col[j]]; } } } diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransim.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransim.html index ddb3b8b..27abcbe 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransim.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransim.html @@ -23,56 +23,58 @@ <html> <head> - <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,target-densitydpi=device-dpi, user-scalable=no" /> - <style> - .show { - z-index: 1000; - position: absolute; - padding: 2px; - display: block; - margin: 0; - list-style-type: none; - list-style: none; - } - - .hide { - display: none; - } - - .btn-group .button { - background-color: LightGrey; - color: black; - border: 1px solid Black; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; - cursor: pointer; - width: 100px; - display: block; - } - - .btn-group .button:not (:last-child) { - border-bottom: none; - } - - .btn-group .button:hover { - background-color: lightblue; - color: white; - } - .button { - background-color: #4CAF50; /* Green */ - border: none; - color: white; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; - margin: 4px 2px; - cursor: pointer; - } - </style> - <script> +<meta name="viewport" + content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,target-densitydpi=device-dpi, user-scalable=no" /> +<style> +.show { + z-index: 1000; + position: absolute; + padding: 2px; + display: block; + margin: 0; + list-style-type: none; + list-style: none; +} + +.hide { + display: none; +} + +.btn-group .button { + background-color: LightGrey; + color: black; + border: 1px solid Black; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + cursor: pointer; + width: 100px; + display: block; +} + +.btn-group .button:not (:last-child ) { + border-bottom: none; +} + +.btn-group .button:hover { + background-color: lightblue; + color: white; +} + +.button { + background-color: #4CAF50; /* Green */ + border: none; + color: white; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; +} +</style> +<script> var childWindow; var ScreenConfig; @@ -138,11 +140,7 @@ var physicalCellId = topoObj.cellTopology[i].physicalCellId; var serverId = topoObj.cellTopology[i].serverId; var confColor = noProblemColor; - /*if (typeof topoObj.cellTopology[i].color != 'undefined') { - confColor = topoObj.cellTopology[i].color; - console.log("topoObj.cellTopology[i].color:"); - console.log(topoObj.cellTopology[i].color); - }*/ + confColor = topoObj.cellTopology[i].color; console.log("topoObj.cellTopology[i].color:"); console.log(topoObj.cellTopology[i].color); @@ -249,7 +247,6 @@ 'menubar=no, locationbar=no, toolbar=no, width=500px, height=300px' ); - //alert("Cell Id:" + nodeVal + "\nPhysical Cell Id:" + cellVal + "\nPnf Name:" + pnfName); }); document.getElementById("showNeighbours").addEventListener("click", function() { @@ -301,35 +298,6 @@ ScreenConfig, topoObj) { document.getElementById("modified").innerHTML = 'b'; - /* for (i in topoObj.cellTopology) { - var n = topoObj.cellTopology[i].nodeId; - var p = topoObj.cellTopology[i].physicalCellId; - if (typeof topoObj.cellTopology[i].color != 'undefined') { - confColor = topoObj.cellTopology[i].color; - } - var x = (topoObj.cellTopology[i].screenX - topoObj.minScreenX ) * ScreenConfig.xScaleUnit + 20; - var y = (topoObj.cellTopology[i].screenY - topoObj.minScreenY ) * ScreenConfig.yScaleUnit + 20; - - if (topoObj.cellTopology[i].sectorNumber == 1) { - x -= RADIUS; - } else if (topoObj.cellTopology[i].sectorNumber == 2) { - x += RADIUS; - } else if (topoObj.cellTopology[i].sectorNumber == 3) { - y += 1.8 * RADIUS; - } - - ScreenConfig.context.fillStyle = "#BFBFBF"; - ScreenConfig.context.beginPath(); - ScreenConfig.context.arc(x, y, RADIUS, 0, Math.PI * 2, true); - ScreenConfig.context.strokeStyle = "black"; - ScreenConfig.context.stroke(); - ScreenConfig.context.closePath(); - ScreenConfig.context.fill(); - ScreenConfig.context.font = "bold 11px Comic Sans MS"; - ScreenConfig.context.fillStyle = "black"; - ScreenConfig.context.textAlign = "center"; - fillMultiLineText(ScreenConfig.context, p, x, y); - } */ for (i in neighbour.cellsWithHo) { var neighbourNodeId = neighbour.cellsWithHo[i].nodeId; @@ -392,9 +360,6 @@ ScreenConfig.context.lineTo(nbrCellX-headlen*Math.cos(angle+Math.PI/6),nbrCellY-headlen*Math.sin(angle+Math.PI/6)); ScreenConfig.context.stroke(); ScreenConfig.context.closePath(); - - - ScreenConfig.context.fillStyle = confuColor; ScreenConfig.context.beginPath(); ScreenConfig.context.arc(nbrCellX, nbrCellY, RADIUS, 0, Math.PI * 2, true); @@ -495,7 +460,6 @@ "nodeId": cid } var dataObj = JSON.stringify(formVal); - //var dataObj = JSON.stringify(formVal); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { @@ -529,7 +493,6 @@ "nodeId": cid } var dataObj = JSON.stringify(formVal); - //var dataObj = JSON.stringify(formVal); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { @@ -541,12 +504,7 @@ else neighbourNodeIds += ',' + neighbour.cellsWithHo[i].nodeId; } - /*for (i in neighbour.cellsWithNoHo) { - if (neighbourNodeIds.length == 0) - neighbourNodeIds += neighbour.cellsWithNoHo[i].nodeId; - else - neighbourNodeIds += ',' + neighbour.cellsWithNoHo[i].nodeId; - }*/ + var neighbrList = escape(neighbourNodeIds); childWindow = window.open('modifyCellPci.html?cid=' + cid + '&pcid=' + pcid + '&neighbrList=' + neighbrList, '', @@ -585,8 +543,6 @@ } function isIntersect(point, currCell, cellX, cellY, ScreenConfig) { - //var cellX = currCell.screenX * ScreenConfig.xScaleUnit; - //var cellY = currCell.screenY * ScreenConfig.yScaleUnit; if (currCell.sectorNumber == 1) { cellX -= ScreenConfig.RADIUS; @@ -616,7 +572,6 @@ } function searchCell(){ - //alert("enter netconf server id"); var serverId = document.getElementById("myText").value;; netconfServerUserInput = serverId; console.log("netconfServerUserInput"); @@ -677,15 +632,16 @@ </head> <body onLoad="init();" style="margin: 0px"> - <div class="hide" id="rmenu"></div> - <div class="hide" id="modified"></div> - <div id="ransim" class="absolute"> - PNF/Cell name: <input type="text" id="myText" size="9" value="ncserver00"> + <div class="hide" id="rmenu"></div> + <div class="hide" id="modified"></div> + <div id="ransim" class="absolute"> + PNF/Cell name: <input type="text" id="myText" size="9" + value="ncserver00"> <button onclick="searchCell()">Search</button> <br> - + </div> - <canvas id="myCanvas" width="500000" height="500000"></canvas> + <canvas id="myCanvas" width="500000" height="500000"></canvas> </body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransimgrid.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransimgrid.html index bf097fd..f2ca56c 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransimgrid.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/ransimgrid.html @@ -51,22 +51,34 @@ } .btn-group + + .button + + :not + + ( :last-child + + ) { border-bottom + + : + + none -; +; } .btn-group .button:hover { background-color: lightblue; @@ -91,59 +103,10 @@ function getCellTopology() { }; xmlhttp.open("GET", "http://ransimsvr:8081/ransim/api/GetTopology", true); xmlhttp.send(); - /* - var topologyJson = { - "gridSize": 10, - "cellTopology": [ - {"nodeId":55, "physicalCellId":"70", "gridX":1, "gridY":1, "confusion":true, "color":"#FF0000" }, - {"nodeId":58, "physicalCellId":"72", "gridX":1, "gridY":4 }, - {"nodeId":57, "physicalCellId":"73", "gridX":1, "gridY":3 }, - {"nodeId":56, "physicalCellId":"71", "gridX":1, "gridY":2 }, - {"nodeId":65, "physicalCellId":"70", "gridX":3, "gridY":2, "confusion":true, "color":"#FF0000" } - ]} - drawTopology(topologyJson); - */ - /* var topologyJson = {"gridSize":10, - "cellTopology":[ - {"nodeId":51,"physicalCellId":20,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":5,"gridY":1,"serverId":"ncserver1003"}, - {"nodeId":52,"physicalCellId":4,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":5,"gridY":2,"serverId":"ncserver1003"}, - {"nodeId":61,"physicalCellId":10,"pciCollisionDetected":true,"pciConfusionDetected":false,"gridX":6,"gridY":1,"serverId":"ncserver1004"}, - {"nodeId":62,"physicalCellId":5,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":6,"gridY":2,"serverId":"ncserver1004"}, - {"nodeId":63,"physicalCellId":6,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":6,"gridY":3,"serverId":"ncserver1004"}, - {"nodeId":68,"physicalCellId":9,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":6,"gridY":8,"serverId":"ncserver1004"}, - {"nodeId":71,"physicalCellId":2,"pciCollisionDetected":true,"pciConfusionDetected":false,"gridX":7,"gridY":1,"serverId":"ncserver1005"}, - {"nodeId":72,"physicalCellId":8,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":7,"gridY":2,"serverId":"ncserver1005"}, - {"nodeId":73,"physicalCellId":1,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":7,"gridY":3,"serverId":"ncserver1005"}, - {"nodeId":76,"physicalCellId":2,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":7,"gridY":6,"serverId":"ncserver1005"}, - {"nodeId":77,"physicalCellId":5,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":7,"gridY":7,"serverId":"ncserver1005"}, - {"nodeId":78,"physicalCellId":3,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":7,"gridY":8,"serverId":"ncserver1005"}, - {"nodeId":79,"physicalCellId":4,"pciCollisionDetected":true,"pciConfusionDetected":false,"gridX":7,"gridY":9,"serverId":"ncserver1005"}, - {"nodeId":80,"physicalCellId":15,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":7,"gridY":10,"serverId":"ncserver1005"}, - {"nodeId":81,"physicalCellId":13,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":8,"gridY":1,"serverId":"ncserver1005"}, - {"nodeId":82,"physicalCellId":14,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":8,"gridY":2,"serverId":"ncserver1005"}, - {"nodeId":83,"physicalCellId":3,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":8,"gridY":3,"serverId":"ncserver1005"}, - {"nodeId":86,"physicalCellId":6,"pciCollisionDetected":true,"pciConfusionDetected":true,"gridX":8,"gridY":6,"serverId":"ncserver1006"}, - {"nodeId":87,"physicalCellId":4,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":8,"gridY":7,"serverId":"ncserver1006"}, - {"nodeId":88,"physicalCellId":0,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":8,"gridY":8,"serverId":"ncserver1006"}, - {"nodeId":89,"physicalCellId":1,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":8,"gridY":9,"serverId":"ncserver1006"}, - {"nodeId":90,"physicalCellId":7,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":8,"gridY":10,"serverId":"ncserver1006"}, - {"nodeId":91,"physicalCellId":11,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":9,"gridY":1,"serverId":"ncserver1006"}, - {"nodeId":96,"physicalCellId":5,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":9,"gridY":6,"serverId":"ncserver1006"}, - {"nodeId":97,"physicalCellId":1,"pciCollisionDetected":true,"pciConfusionDetected":false,"gridX":9,"gridY":7,"serverId":"ncserver1006"}, - {"nodeId":98,"physicalCellId":2,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":9,"gridY":8,"serverId":"ncserver1006"}, - {"nodeId":99,"physicalCellId":3,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":9,"gridY":9,"serverId":"ncserver1006"}, - {"nodeId":100,"physicalCellId":4,"pciCollisionDetected":false,"pciConfusionDetected":true,"gridX":9,"gridY":10,"serverId":"ncserver1007"}, - {"nodeId":107,"physicalCellId":8,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":10,"gridY":7,"serverId":"ncserver1007"}, - {"nodeId":108,"physicalCellId":9,"pciCollisionDetected":true,"pciConfusionDetected":true,"gridX":10,"gridY":8,"serverId":"ncserver1007"}, - {"nodeId":109,"physicalCellId":1,"pciCollisionDetected":false,"pciConfusionDetected":false,"gridX":10,"gridY":9,"serverId":"ncserver1007"} - ]} - drawTopology(topologyJson); */ - } function drawTopology(topoObj){ - //alert("topoObj"); var width = window.innerHeight; var height = window.innerHeight;//100; var myCanvas = document.getElementById("myCanvas"); @@ -155,41 +118,18 @@ function drawTopology(topoObj){ context.fillStyle = "#FFFFFF"; context.fillRect(0,0,width,height); - //var gridSize = 15; var gridSize = topoObj.gridSize; var rad=height/(2 * gridSize);//10; var gaps= rad*2; - // alert(rad); var widthCount = parseInt(width/gaps); var heightCount = parseInt(height/gaps); - //var aColors=["#43A9D1","#EFA63B","#EF7625","#5E4130","#EEE","#DDD"]; var aColors="#32CD32"; var aColorsLength = 1; var arr = new Array(); var a=1.5*rad; var b=0.86*rad; - - - /* for(var x=0; x<gridSize;x++) { - arr[x]=new Array(); - for(var y=0; y<gridSize;y++) { - context.fillStyle = "#D3D3D3"; - context.beginPath(); - - context.arc(rad+gaps*x,rad+ gaps*y, rad, 0, Math.PI*2, true); - context.closePath(); - context.fill(); - arr[x][y] = (x+1) + ":" + (y+1); - - context.font = "12px Comic Sans MS"; - context.fillStyle = "white"; - context.textAlign = "center"; - fillMultiLineText(context,"X:"+y+"\nY:"+x, rad+gaps*x,rad+ gaps*y); - - } - } */ - + myCanvas.addEventListener('contextmenu', (e) => { const pos = { x: e.clientX, @@ -237,20 +177,7 @@ function drawTopology(topoObj){ if (typeof topoObj.cellTopology[i].color != 'undefined') { confuColor = topoObj.cellTopology[i].color; } - //alert(nodeId+" "+physicalCellId+" "+col+" "+row+" "+confusion+" "+confuColor+" "); - - /*if (collision) { - if (confusion) { - context.fillStyle = "#FF1493"; - } else { - context.fillStyle = "#FF0000"; - } - - } else if (confusion){ - context.fillStyle = "#CCCC00"; - } else { - context.fillStyle = "#32CD32"; - }*/ + if (confusion) { context.fillStyle = confuColor; } else { @@ -259,24 +186,17 @@ function drawTopology(topoObj){ context.beginPath(); context.arc(rad+gaps*col,rad+gaps*row, rad/2, 0, Math.PI*2, true); - //alert(nodeId+" Circle X " + (rad+gaps*col) + " Y: "+ (rad+gaps*row)); context.strokeStyle = "black"; context.stroke(); context.closePath(); context.fill(); - /* context.beginPath(); - context.moveTo(rad+gaps*col, rad+gaps*row); - context.lineTo(rad+gaps*col,rad+gaps*row - rad/2); - context.strokeStyle = "black"; - context.stroke(); - context.closePath(); */ + context.font = "12px Comic Sans MS"; context.fillStyle = "white"; context.textAlign = "center"; context.fillText(physicalCellId, rad+gaps*col,rad+ gaps*row ); - //fillMultiLineText(context,nodeId, rad+gaps*col,rad+ gaps*row); } myCanvas.addEventListener('contextmenu', (e) => { @@ -293,23 +213,17 @@ function drawTopology(topoObj){ --row; var col = topoObj.cellTopology[i].gridY; --col; - //alert('click on circle: ' + topoObj.cellTopology[i].nodeId); - //alert(pos.x + " "+pos.y); document.getElementById("rmenu").className = "show"; document.getElementById('rmenu').style.top = pos.y+"px"; //or whatever document.getElementById('rmenu').style.left = pos.x+"px"; // or whatever var htmlText1 = '<div class="btn-group">'; htmlText1 += '<button class="button" id="showNeighbours">showNeighbours</button>'; - //htmlText1 += '<button class="button" id="deleteNode">Delete</button>'; htmlText1 += '</div>'; document.getElementById("rmenu").innerHTML = htmlText1; document.getElementById("showNeighbours").addEventListener("click", function(){ alert(topoObj.cellTopology[i].nodeId); - //alert(col); - //alert(i); - //change(topoObj,row,col); var formVal = { "nodeId": nodeVal } @@ -327,9 +241,7 @@ function drawTopology(topoObj){ xmlhttp.setRequestHeader('Content-Type', 'application/json') xmlhttp.send(dataObj); }); - /* document.getElementById("deleteNode").addEventListener("click", function(){ - deleteNode(nodeVal, cellVal); - }); */ + } } e.preventDefault(); @@ -350,9 +262,7 @@ function drawTopology(topoObj){ context.fillStyle = "#FFFFFF"; context.fillRect(0,0,width,height); - //var gridSize = 15; var gridSize = topoObj.gridSize; - //alert(gridSize); var rad=height/(2 * gridSize);//10; var gaps= rad*2; @@ -372,11 +282,6 @@ function drawTopology(topoObj){ context.textAlign = "center"; context.fillText(cellPhysicalCellId, rad+gaps*col,rad+ gaps*row ); - - - /* var res = $http.post('http://ransimsvr:8081/ransim/api/GetNeighborList', dataObj) - var neighbour = JSON.parse(res); */ - for (i in neighbour.neighborList) { var neighbourNodeId = neighbour.neighborList[i].nodeId; @@ -394,12 +299,7 @@ function drawTopology(topoObj){ confusion = neighbour.neighborList[i].pciConfusionDetected; } - /* var confuColor = aColors; - if (typeof neighbour.neighborList[i].color != 'undefined') { - confuColor = neighbour.neighborList[i].color; - } */ - //alert(nodeId+" "+physicalCellId+" "+col+" "+row+" "+confusion+" "+confuColor+" "); - + if (collision) { if (confusion) { context.fillStyle = "#FF1493"; @@ -415,7 +315,6 @@ function drawTopology(topoObj){ context.beginPath(); context.arc(rad+gaps*col,rad+gaps*row, rad/2, 0, Math.PI*2, true); - //alert(nodeId+" Circle X " + (rad+gaps*col) + " Y: "+ (rad+gaps*row)); context.strokeStyle = "black"; context.stroke(); context.closePath(); @@ -433,7 +332,6 @@ function drawTopology(topoObj){ context.fillStyle = "white"; context.textAlign = "center"; context.fillText(neighbourPhysicalCellId, rad+gaps*col,rad+ gaps*row ); - //fillMultiLineText(context,nodeId, rad+gaps*col,rad+ gaps*row); } @@ -454,24 +352,12 @@ function drawTopology(topoObj){ context.fillStyle = "#FFFFFF"; context.fillRect(0,0,width,height); - //var gridSize = 15; var gridSize = topoObj.gridSize; - //alert(gridSize); var rad=height/(2 * gridSize);//10; var gaps= rad*2; - // alert(rad); - - //var row = topoObj.cellTopology[i].gridX; - //--row; - //alert(topoObj.cellTopology[i].nodeId); - //var col = topoObj.cellTopology[i].gridY; - //--col; - //alert(col); - //alert(i); - //context.arc(rad+gaps*col,rad+ gaps*row, rad/2, 0, Math.PI*2, true); - //alert(rad+ gaps*row); + context.fillStyle = "#D3D3D3"; context.beginPath(); @@ -535,11 +421,7 @@ function drawTopology(topoObj){ document.getElementById("rmenu").className = "hide"; }); - /* - $(document).bind("click", function(event) { - document.getElementById("rmenu").className = "hide"; - }); - */ + function isIntersectDefault(point, row, col, rad, gaps) { var x = (rad+gaps*col); diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startPm.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startPm.html index 1426e54..c5a82d7 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startPm.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startPm.html @@ -20,59 +20,62 @@ --> <html> - <head> - <title>PM</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body> - <center> - <h2>Enter the cells with Hand-off Failures</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td>Node Id(bad value):</td> - <td><input name = "nodeIdBad" type = "string" ng-model = "nodeIdBad"> - <br> - </td> - </tr> - <tr> - <td colspan=2> Bad Value: A Cell for which 20% of its neighbors will have very high percentage of Hand-Off failure. The Cell-Neighbor pair should be blackisted.</td> - </tr> - <tr> - <td>Node Id(poor value):</td> - <td><input name = "nodeIdPoor" type = "string" ng-model = "nodeIdPoor"> - <br> - </td> - </tr> - <tr> - <td colspan=2> Poor Value: A Cell for which 20% of its neighbors will have a considerable percentage of Hand-Off failure.</td> - </tr> - <tr> - <td colspan=2 align=center> - <button ng-click="startPm()">Start</button> - <button ng-click = "close()">Close</button> - </td> - </tr> - </table> - </form> - </div> - <script> +<head> +<title>PM</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Enter the cells with Hand-off Failures</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Node Id(bad value):</td> + <td><input name="nodeIdBad" type="string" + ng-model="nodeIdBad"> <br></td> + </tr> + <tr> + <td colspan=2>Bad Value: A Cell for which 20% of its + neighbors will have very high percentage of Hand-Off failure. The + Cell-Neighbor pair should be blackisted.</td> + </tr> + <tr> + <td>Node Id(poor value):</td> + <td><input name="nodeIdPoor" type="string" + ng-model="nodeIdPoor"> <br></td> + </tr> + <tr> + <td colspan=2>Poor Value: A Cell for which 20% of its + neighbors will have a considerable percentage of Hand-Off + failure.</td> + </tr> + <tr> + <td colspan=2 align=center> + <button ng-click="startPm()">Start</button> + <button ng-click="close()">Close</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', function($scope, $http) { $scope.startPm = function(){ @@ -88,11 +91,9 @@ var res = $http.post('/ransim/api/GeneratePmData', dataObj) .then(function successCallback(response){ - //alert("Request sent Successfully"); window.close(); }, function errorCallback(response){ - //alert("Request Failed"); window.close(); }); @@ -101,6 +102,7 @@ window.close(); } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startsPm.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startsPm.html index e44243b..59d78bd 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startsPm.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/startsPm.html @@ -20,59 +20,60 @@ --> <html> - <head> - <title>PM</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body> - <center> - <h2>Enter the cells with Hand-off Failures</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td>Node Id(bad value):</td> - <td><input name = "nodeIdBad" type = "string" ng-model = "nodeIdBad"> - <br> - </td> - </tr> - <tr> - <td colspan=2> Bad Value: Enter the ids of the cell(s) for which the HO to a few neighbors will have less than 25% success.</td> - </tr> - <tr> - <td>Node Id(poor value):</td> - <td><input name = "nodeIdPoor" type = "string" ng-model = "nodeIdPoor"> - <br> - </td> - </tr> - <tr> - <td colspan=2> Poor Value: Enter the ids of the cell(s) for which the HO to a few neighbors will have 25%-50% success.</td> - </tr> - <tr> - <td colspan=2 align=center> - <button ng-click="startPm()">Start</button> - <button ng-click = "close()">Close</button> - </td> - </tr> - </table> - </form> - </div> - <script> +<head> +<title>PM</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Enter the cells with Hand-off Failures</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Node Id(bad value):</td> + <td><input name="nodeIdBad" type="string" + ng-model="nodeIdBad"> <br></td> + </tr> + <tr> + <td colspan=2>Bad Value: Enter the ids of the cell(s) for + which the HO to a few neighbors will have less than 25% success.</td> + </tr> + <tr> + <td>Node Id(poor value):</td> + <td><input name="nodeIdPoor" type="string" + ng-model="nodeIdPoor"> <br></td> + </tr> + <tr> + <td colspan=2>Poor Value: Enter the ids of the cell(s) for + which the HO to a few neighbors will have 25%-50% success.</td> + </tr> + <tr> + <td colspan=2 align=center> + <button ng-click="startPm()">Start</button> + <button ng-click="close()">Close</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', function($scope, $http) { $scope.startPm = function(){ @@ -101,6 +102,7 @@ window.close(); } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/stopPm.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/stopPm.html index c43e890..d511864 100644 --- a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/stopPm.html +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/stopPm.html @@ -20,46 +20,45 @@ --> <html> - <head> - <title>Performance Management</title> - <script src="angular.min.js"></script> - <style> - table, th , td { - border: 1px solid grey; - border-collapse: collapse; - padding: 5px; - } - - table tr:nth-child(odd) { - background-color: #f2f2f2; - } - - table tr:nth-child(even) { - background-color: #ffffff; - } - </style> - </head> - <body> - <center> - <h2>Performance Management(PM)</h2> - <div data-ng-init="onloadFun()" ng-app = "mainApp" ng-controller = "configController"> - <form name = "configForm" novalidate> - <table border = "0" align=center> - <tr> - <td> - Stop generating PM data - </td> - </tr> - <tr> - <td align=right> - <button ng-click="stopPm()">Yes</button> - <button ng-click = "close()">No</button> - </td> - </tr> - </table> - </form> - </div> - <script> +<head> +<title>Performance Management</title> +<script src="angular.min.js"></script> +<style> +table, th, td { + border: 1px solid grey; + border-collapse: collapse; + padding: 5px; +} + +table tr:nth-child(odd) { + background-color: #f2f2f2; +} + +table tr:nth-child(even) { + background-color: #ffffff; +} +</style> +</head> +<body> + <center> + <h2>Performance Management(PM)</h2> + <div data-ng-init="onloadFun()" ng-app="mainApp" + ng-controller="configController"> + <form name="configForm" novalidate> + <table border="0" align=center> + <tr> + <td>Stop generating PM data</td> + </tr> + <tr> + <td align=right> + <button ng-click="stopPm()">Yes</button> + <button ng-click="close()">No</button> + </td> + </tr> + </table> + </form> + </div> + <script> var mainApp = angular.module("mainApp", []); mainApp.controller('configController',['$scope', '$http', function($scope, $http) { $scope.stopPm = function(){ @@ -89,6 +88,7 @@ window.close(); } }]); - </script> - <center></body> + </script> + <center> +</body> </html> diff --git a/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/uploadFile.html b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/uploadFile.html new file mode 100644 index 0000000..fd55dee --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-GUI/src/main/webapp/uploadFile.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org"> +<body> + +<h1>Spring Boot file upload example</h1> + +<form method="POST" action="/ransim/file/upload" enctype="multipart/form-data"> + <input type="file" name="file" /><br/><br/> + <input type="submit" value="Submit" /> +</form> + +</body> +</html>
\ No newline at end of file diff --git a/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd b/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd index df20485..df20485 100644..100755 --- a/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd +++ b/ransim/ransimctrlr/packages/base/src/files/install/servers/common/tomcat/init.d/tomcatd diff --git a/ransim/ransimctrlr/pom.xml b/ransim/ransimctrlr/pom.xml index ffe6ef5..8c98d49 100644 --- a/ransim/ransimctrlr/pom.xml +++ b/ransim/ransimctrlr/pom.xml @@ -64,49 +64,6 @@ <module>RANSIM-GUI</module> <module>packages</module> </modules> - - <distributionManagement> - <repository> - <id>ecomp-releases</id> - <name>ONAP Release Repository</name> - <url>${nexusproxy}/${releases.path}</url> - </repository> - <snapshotRepository> - <id>ecomp-snapshots</id> - <name>ONAP Snapshot Repository</name> - <url>${nexusproxy}/${snapshots.path}</url> - </snapshotRepository> - <site> - <id>ecomp-site</id> - <url>dav:${nexusproxy}${sitePath}</url> - </site> - </distributionManagement> - - <repositories> - <!-- LF repositories --> - <repository> - <id>ecomp-releases</id> - <name>Release Repository</name> - <url>${nexusproxy}/content/repositories/releases/</url> - </repository> - <repository> - <id>ecomp-staging</id> - <name>Staging Repository</name> - <url>${nexusproxy}/content/repositories/staging/</url> - </repository> - <repository> - <id>ecomp-snapshots</id> - <name>Snapshots Repository</name> - <url>${nexusproxy}/content/repositories/snapshots/</url> - </repository> - <repository> - <id>ecomp-public</id> - <name>Public Repository</name> - <url>${nexusproxy}/content/repositories/public/</url> - </repository> - <!-- LF repositories END --> - </repositories> - <reporting> <plugins> <plugin> @@ -138,22 +95,6 @@ </dependency> </dependencies> </dependencyManagement> - - <dependencies> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> - </dependency> - <dependency> - <!-- org.w3c.dom dependencies --> - <groupId>xml-apis</groupId> - <artifactId>xml-apis</artifactId> - <version>1.3.03</version> - </dependency> - </dependencies> - <build> <plugins> <plugin> |