diff options
Diffstat (limited to 'ransim/ransimctrlr')
150 files changed, 11707 insertions, 11474 deletions
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 index 8ccb561..4bbd401 100644 --- 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 @@ -30,8 +30,8 @@ import org.springframework.context.annotation.ComponentScan; @EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class) public class Application { - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } + 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 index e47ae35..029e182 100644 --- 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 @@ -40,30 +40,32 @@ import org.springframework.transaction.PlatformTransactionManager; @Configuration @PropertySource({"classpath:application.properties"}) -@EnableJpaRepositories(basePackages = "org.onap.ransim.rest.api.repository" - + "", entityManagerFactoryRef = "entityManager", transactionManagerRef = "transactionManager") +@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(); + + @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 @@ -89,6 +91,5 @@ public class RansimDbConfig { 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 index 78f5d56..68be82a 100644 --- 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 @@ -25,9 +25,9 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer public class ServletInitializer extends SpringBootServletInitializer { - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(Application.class); - } + @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 index 7313b64..f4dc174 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java @@ -20,219 +20,220 @@ package org.onap.ransim.netconf; -import java.io.IOException; -import java.net.ConnectException; -import org.apache.log4j.Logger; 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 org.onap.ransim.rest.web.mapper.NearRTRICModel; + +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); - } - } + 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 index c4197e8..905df8a 100644 --- 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 @@ -50,42 +50,42 @@ import org.springframework.web.multipart.MultipartFile; @PropertySource(value = "classpath:dumpfileNames.properties") public class FileController { - static Logger log = Logger.getLogger(FileController.class.getName()); + static Logger log = Logger.getLogger(FileController.class.getName()); - private static final String fileBasePath = "/tmp/ransim-install/config/"; + private static final String fileBasePath = "/tmp/ransim-install/config/"; - @Value("${defaultFiles:}") - List<String> fileList = new ArrayList<>(); + @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 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); - } + /** + * 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 index a3eb040..b6a661d 100644 --- 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 @@ -23,20 +23,6 @@ package org.onap.ransim.rest.api.controller; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -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.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.onap.ransim.rest.api.models.NSSAIConfig; import org.onap.ransim.rest.api.services.RANSliceConfigService; @@ -48,540 +34,583 @@ 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); - } - } + 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 5d15e58..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 @@ -20,17 +20,28 @@ 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.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; +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.DeleteACellReq; @@ -44,14 +55,12 @@ 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.onap.ransim.rest.api.models.TACells; -import org.onap.ransim.rest.api.services.RansimControllerServices; +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.controller.RANSliceConfigController; -import org.onap.ransim.rest.api.handler.RansimPciHandler; -import org.onap.ransim.rest.api.handler.RansimSlicingHandler; +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; @@ -63,699 +72,709 @@ 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 org.onap.ransim.rest.api.services.SlicingPMDataGenerator; -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("/api") @CrossOrigin(origins = "*") public class RansimController { - 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") + 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***************************"); - + @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); + 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); - + 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") }) + @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()); + log.info("1. execServiceForIntelligentSlicing.isTerminated(): " + + execServiceForIntelligentSlicing.isTerminated()); if (!execServiceForIntelligentSlicing.isTerminated()) { - execServiceForIntelligentSlicing.shutdown(); - log.info("2. execServiceForIntelligentSlicing.isTerminated(): " + 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); - } + /* + * 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 { + @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()); + 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); + } + return new ResponseEntity<>("Closed loop PM data generated.", HttpStatus.OK); - } catch (Exception eu) { - return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); - } + } 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/exceptions/RansimException.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/exceptions/RansimException.java index e72b528..a9aaf2f 100644 --- 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 @@ -22,26 +22,24 @@ 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); - } - - + 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 index e185108..881d19b 100644 --- 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 @@ -20,6 +20,8 @@ package org.onap.ransim.rest.api.handler; +import com.google.gson.Gson; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -32,6 +34,7 @@ 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; @@ -60,392 +63,355 @@ 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; -import com.google.gson.Gson; @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) { - + + 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"); @@ -454,510 +420,481 @@ public class RansimPciHandler { 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 (!addedNbrs.equals("")) { + message += " Neighbors added " + addedNbrs + "."; } - - if(!deletedNbrs.equals("")){ - message += " Neighbors removed " + deletedNbrs + "." ; + + 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 "); - } - - } + + /** + * 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 index c435541..4629fc6 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/handler/RansimSlicingHandler.java @@ -20,6 +20,8 @@ package org.onap.ransim.rest.api.handler; +import com.google.gson.Gson; + import java.io.File; import java.time.LocalDateTime; import java.util.ArrayList; @@ -27,9 +29,10 @@ 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 javax.websocket.Session; import org.apache.log4j.Logger; import org.onap.ransim.rest.api.services.RANSliceConfigService; @@ -39,9 +42,9 @@ 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.server.RansimWebSocketServer; 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; @@ -49,217 +52,208 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; -import com.google.gson.Gson; import org.springframework.stereotype.Service; -import org.springframework.beans.factory.annotation.Autowired; +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; + static Logger log = Logger.getLogger(RansimSlicingHandler.class.getName()); - 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)); - } - } - } - } + @Autowired + RansimRepositoryService ransimRepo; - 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); - } - } - } - - } + @Autowired + RansimControllerServices rscServices; - 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; -} + @Autowired + RANSliceConfigService ranSliceConfigService; -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 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>(); -public void sendIntelligentSlicingPmData( SlicingPmMessage pmMessage) { + 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)); + } + } + } + } - log.info("inside sendIntelligentSlicingPmData"); - - Gson gson = new Gson(); - String jsonStr = gson.toJson(pmMessage); + 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); + } + } + } - log.info("IntelligentSlicingPmData " + jsonStr); + } - String ipPort = RansimControllerServices.serverIdIpPortMapping.get(pmMessage.getSourceName()); + MeasValue measValue = new MeasValue(nRCellCUModel.getCellLocalId(), resultList, false); + measValueList.add(measValue); + } - if (ipPort != null && !ipPort.trim().equals("")) { + 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; + } - 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 "); - } - - } -} + 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 046d64a..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 @@ -24,39 +24,39 @@ 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. - */ - 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; - } + 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. + */ + 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 1c393d4..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 @@ -29,224 +29,224 @@ import javax.persistence.Table; @Table(name = "CellDetails") public class CellDetails implements Comparable<CellDetails> { - private String networkId; - private String nodeId; - private long physicalCellId; - private String nodeName; - private String nodeType; - private boolean pciCollisionDetected; - private boolean pciConfusionDetected; - private float gridX; - private float gridY; - private float screenX; - private float screenY; - private String latitude; - private String longitude; - 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. - */ - public CellDetails(String nodeId, long physicalCellId, String serverId) { - super(); - this.nodeId = nodeId; - 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 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) { - super(); - this.networkId = networkId; - this.nodeId = nodeId; - this.physicalCellId = physicalCellId; - this.nodeName = nodeName; - this.nodeType = nodeType; - this.pciCollisionDetected = pciCollisionDetected; - this.pciConfusionDetected = pciConfusionDetected; - - this.gridX = gridX; - this.gridY = gridY; - this.screenX = screenX; - this.screenY = screenY; - this.latitude = latitude; - this.longitude = longitude; - this.serverId = serverId; - 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 + "]"; - } - - @Override - public int compareTo(CellDetails cd) { - return this.getNodeId().compareTo(cd.getNodeId()); - } + private String networkId; + private String nodeId; + private long physicalCellId; + private String nodeName; + private String nodeType; + private boolean pciCollisionDetected; + private boolean pciConfusionDetected; + private float gridX; + private float gridY; + private float screenX; + private float screenY; + private String latitude; + private String longitude; + 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. + */ + public CellDetails(String nodeId, long physicalCellId, String serverId) { + super(); + this.nodeId = nodeId; + 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 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) { + super(); + this.networkId = networkId; + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + this.nodeName = nodeName; + this.nodeType = nodeType; + this.pciCollisionDetected = pciCollisionDetected; + this.pciConfusionDetected = pciConfusionDetected; + + this.gridX = gridX; + this.gridY = gridY; + this.screenX = screenX; + this.screenY = screenY; + this.latitude = latitude; + this.longitude = longitude; + this.serverId = serverId; + 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 + "]"; + } + + @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 9a1b8da..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 @@ -22,95 +22,95 @@ package org.onap.ransim.rest.api.models; public class CellInfo { - private String networkId; - private String nodeId; - private long physicalCellId; - private String pnfName; - 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 - */ - public CellInfo(String networkId, String nodeId, long physicalCellId, String pnfName, int sectorNumber, - String latitude, String longitude) { - super(); - this.networkId = networkId; - this.nodeId = nodeId; - this.physicalCellId = physicalCellId; - this.pnfName = pnfName; - this.sectorNumber = sectorNumber; - 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; - } + private String networkId; + private String nodeId; + private long physicalCellId; + private String pnfName; + 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 + */ + public CellInfo(String networkId, String nodeId, long physicalCellId, String pnfName, int sectorNumber, + String latitude, String longitude) { + super(); + this.networkId = networkId; + this.nodeId = nodeId; + this.physicalCellId = physicalCellId; + this.pnfName = pnfName; + this.sectorNumber = sectorNumber; + 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 f0b9872..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 @@ -27,8 +27,8 @@ import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.Id; import javax.persistence.FetchType; +import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -39,48 +39,48 @@ import org.onap.ransim.rest.api.controller.RansimController; @Table(name = "CellNeighbor") public class CellNeighbor { - @Id - @Column(name = "nodeId", unique = true, nullable = false, length = 52) - private String nodeId; + @Id + @Column(name = "nodeId", unique = true, nullable = false, length = 52) + private String nodeId; - @OneToMany(targetEntity = NeighborDetails.class,fetch = FetchType.EAGER, cascade = CascadeType.ALL) - private Set<NeighborDetails> neighborList; + @OneToMany(targetEntity = NeighborDetails.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL) + private Set<NeighborDetails> neighborList; - public CellNeighbor() { - super(); - } + public CellNeighbor() { + super(); + } - public CellNeighbor(String nodeId, Set<NeighborDetails> neighborList) { - super(); - this.nodeId = nodeId; - this.neighborList = neighborList; - } + public CellNeighbor(String nodeId, Set<NeighborDetails> neighborList) { + super(); + this.nodeId = nodeId; + this.neighborList = neighborList; + } - public String getNodeId() { - return nodeId; - } + public String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } - public Set<NeighborDetails> getNeighborList() { - return neighborList; - } + public Set<NeighborDetails> getNeighborList() { + return neighborList; + } - public void setNeighborList(Set<NeighborDetails> neighborList) { - this.neighborList = neighborList; - } + public void setNeighborList(Set<NeighborDetails> neighborList) { + this.neighborList = neighborList; + } - static Logger log = Logger.getLogger(RansimController.class.getName()); + static Logger log = Logger.getLogger(RansimController.class.getName()); - public void display() { + 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()); - } + 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()); + } - } + } } 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 index 9af5537..afa454b 100644 --- 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 @@ -22,22 +22,21 @@ package org.onap.ransim.rest.api.models; public class ConfigData { - private int maxNumberOfConns; + private int maxNumberOfConns; - public ConfigData() { - } + public ConfigData() { + } - public ConfigData(int maxNumberOfConns) { - super(); - this.maxNumberOfConns = maxNumberOfConns; - } + public ConfigData(int maxNumberOfConns) { + super(); + this.maxNumberOfConns = maxNumberOfConns; + } - public int getMaxNumberOfConns() { - return maxNumberOfConns; - } + public int getMaxNumberOfConns() { + return maxNumberOfConns; + } - public void setMaxNumberOfConns(int maxNumberOfConns) { - this.maxNumberOfConns = 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 618facf..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 @@ -24,54 +24,54 @@ import java.io.Serializable; public class CreateACellReq implements Serializable { - private long physicalCellId; + private long physicalCellId; - private int gridX; - private int gridY; + private int gridX; + private int gridY; - private static final long serialVersionUID = 3736300675426332512L; + private static final long serialVersionUID = 3736300675426332512L; - public CreateACellReq() { - // Default constructor for CreateACellReq - } + 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 - */ - public CreateACellReq(long physicalCellId, int gridX, int gridY) { - super(); + /** + * 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 + */ + public CreateACellReq(long physicalCellId, int gridX, int gridY) { + super(); - this.physicalCellId = physicalCellId; + this.physicalCellId = physicalCellId; - this.gridX = gridX; - this.gridY = gridY; - } + this.gridX = gridX; + this.gridY = gridY; + } - public long getPhysicalCellId() { - return physicalCellId; - } + public long getPhysicalCellId() { + return physicalCellId; + } - public void setPhysicalCellId(long physicalCellId) { - this.physicalCellId = physicalCellId; - } + public void setPhysicalCellId(long physicalCellId) { + this.physicalCellId = physicalCellId; + } - public int getGridX() { - return gridX; - } + public int getGridX() { + return gridX; + } - public void setGridX(int gridX) { - this.gridX = gridX; - } + public void setGridX(int gridX) { + this.gridX = gridX; + } - public int getGridY() { - return gridY; - } + public int getGridY() { + return gridY; + } - public void setGridY(int gridY) { - this.gridY = 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 a6a7baf..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 @@ -22,28 +22,28 @@ package org.onap.ransim.rest.api.models; public class DeleteACellReq { - private String nodeId; + private String nodeId; - /** - * A constructor for DeleteACellReq. - * - * @param nodeId node Id of the cell to be deleted - */ - public DeleteACellReq(String nodeId) { - super(); - this.nodeId = nodeId; - } + /** + * A constructor for DeleteACellReq. + * + * @param nodeId node Id of the cell to be deleted + */ + public DeleteACellReq(String nodeId) { + super(); + this.nodeId = nodeId; + } - public DeleteACellReq() { + public DeleteACellReq() { - } + } - public String getNodeId() { - return nodeId; - } + public String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = 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 6b00369..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 @@ -22,50 +22,50 @@ package org.onap.ransim.rest.api.models; public class FmAlarmInfo { - private String problem; - private String collisionCount; - private String confusionCount; + private String problem; + private String collisionCount; + private String confusionCount; - public FmAlarmInfo() { - super(); - } + 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. - */ - public FmAlarmInfo(String problem, String collisionCount, String confusionCount) { - super(); - this.problem = problem; - this.collisionCount = collisionCount; - this.confusionCount = confusionCount; - } + /** + * 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. + */ + public FmAlarmInfo(String problem, String collisionCount, String confusionCount) { + super(); + this.problem = problem; + this.collisionCount = collisionCount; + this.confusionCount = confusionCount; + } - public String getProblem() { - return problem; - } + public String getProblem() { + return problem; + } - public void setProblem(String problem) { - this.problem = problem; - } + public void setProblem(String problem) { + this.problem = problem; + } - public String getCollisionCount() { - return collisionCount; - } + public String getCollisionCount() { + return collisionCount; + } - public void setCollisionCount(String collisionCount) { - this.collisionCount = collisionCount; - } + public void setCollisionCount(String collisionCount) { + this.collisionCount = collisionCount; + } - public String getConfusionCount() { - return confusionCount; - } + public String getConfusionCount() { + return confusionCount; + } - public void setConfusionCount(String confusionCount) { - this.confusionCount = 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 index 6efb34c..71f8b07 100644 --- 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 @@ -35,79 +35,79 @@ 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; - } + 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 index 5a3af3e..790a638 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/GNBCUUPFunction.java @@ -37,79 +37,78 @@ 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 - + "]"; - } + 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 index 2df9786..618d61b 100644 --- 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 @@ -22,6 +22,7 @@ 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; @@ -34,89 +35,89 @@ 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; - } + 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 8d49d1a..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 @@ -22,28 +22,28 @@ package org.onap.ransim.rest.api.models; public class GetACellDetailReq { - private String nodeId; + private String nodeId; - /** - * A constructor for GetACellDetailReq. - * - * @param nodeId node id of the cell - */ - public GetACellDetailReq(String nodeId) { - super(); - this.nodeId = nodeId; - } + /** + * A constructor for GetACellDetailReq. + * + * @param nodeId node id of the cell + */ + public GetACellDetailReq(String nodeId) { + super(); + this.nodeId = nodeId; + } - public GetACellDetailReq() { + public GetACellDetailReq() { - } + } - public String getNodeId() { - return nodeId; - } + public String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = 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 320db9d..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,56 +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; + private String nodeId; + private List<CellDetails> cellsWithNoHo; + private List<CellDetails> cellsWithHo; - public GetNeighborList() { - super(); - } + 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. - */ - public GetNeighborList(String nodeId, List<CellDetails> cellsWithNoHo, List<CellDetails> cellsWithHo) { - super(); - this.nodeId = nodeId; - this.cellsWithNoHo = cellsWithNoHo; - this.cellsWithHo = cellsWithHo; - } + /** + * 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. + */ + 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 String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } - public List<CellDetails> getCellsWithNoHo() { - return cellsWithNoHo; - } + public List<CellDetails> getCellsWithNoHo() { + return cellsWithNoHo; + } - public void setCellsWithNoHo(List<CellDetails> cellsWithNoHo) { - this.cellsWithNoHo = cellsWithNoHo; - } + public void setCellsWithNoHo(List<CellDetails> cellsWithNoHo) { + this.cellsWithNoHo = cellsWithNoHo; + } - public List<CellDetails> getCellsWithHo() { - return cellsWithHo; - } + public List<CellDetails> getCellsWithHo() { + return cellsWithHo; + } - public void setCellsWithHo(List<CellDetails> cellsWithHo) { - this.cellsWithHo = 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 3ec491c..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 @@ -22,28 +22,28 @@ package org.onap.ransim.rest.api.models; public class GetNeighborListReq { - private String nodeId; + private String nodeId; - public GetNeighborListReq() { + public GetNeighborListReq() { - } + } - /** - * A constructor for GetNeighborListReq. - * - * @param nodeId node Id of the cell who's neighbor list is required - */ - public GetNeighborListReq(String nodeId) { - super(); - this.nodeId = nodeId; - } + /** + * A constructor for GetNeighborListReq. + * + * @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 String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = 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 5349190..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 @@ -22,29 +22,29 @@ 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 - */ - 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; - } + private String serverId; + + /** + * A constructor for GetNetconfServerDetailsReq. + * + * @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 245dea3..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,43 +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. - */ - 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; - } + 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. + */ + 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 6b2cf32..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 @@ -21,72 +21,72 @@ 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 - */ - public GetTopology(CellDetails currentCell, int gridX, int gridY, String nodeId, long physicalCellId) { - super(); - this.currentCell = currentCell; - this.gridX = gridX; - this.gridY = gridY; - 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; - } + 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 + */ + public GetTopology(CellDetails currentCell, int gridX, int gridY, String nodeId, long physicalCellId) { + super(); + this.currentCell = currentCell; + this.gridX = gridX; + this.gridY = gridY; + 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 6d20fcf..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 @@ -22,52 +22,52 @@ package org.onap.ransim.rest.api.models; public class ModifyACellReq { - private String nodeId; - private Long newPhysicalCellId; - private String newNbrs; + 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 - */ - public ModifyACellReq(String nodeId, Long newPhysicalCellId, String newNbrs) { - super(); - this.nodeId = nodeId; - this.newPhysicalCellId = newPhysicalCellId; - this.newNbrs = 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 + */ + public ModifyACellReq(String nodeId, Long newPhysicalCellId, String newNbrs) { + super(); + this.nodeId = nodeId; + this.newPhysicalCellId = newPhysicalCellId; + this.newNbrs = newNbrs; - } + } - public ModifyACellReq() { + public ModifyACellReq() { - // Default constructor for ModifyCell - } + // Default constructor for ModifyCell + } - public String getNodeId() { - return nodeId; - } + public String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } - public Long getNewPhysicalCellId() { - return newPhysicalCellId; - } + public Long getNewPhysicalCellId() { + return newPhysicalCellId; + } - public void setNewPhysicalCellId(Long newPhysicalCellId) { - this.newPhysicalCellId = newPhysicalCellId; - } + public void setNewPhysicalCellId(Long newPhysicalCellId) { + this.newPhysicalCellId = newPhysicalCellId; + } - public String getNewNbrs() { - return newNbrs; - } + public String getNewNbrs() { + return newNbrs; + } - public void setNewNbrs(String newNbrs) { - this.newNbrs = 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 index 89ffdd7..2d49f63 100644 --- 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 @@ -22,6 +22,7 @@ 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; @@ -37,50 +38,49 @@ 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; + 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 Integer getCellLocalId() { + return cellLocalId; + } - public void setCellLocalId(Integer cellLocalId) { - this.cellLocalId = cellLocalId; - } + public void setCellLocalId(Integer cellLocalId) { + this.cellLocalId = cellLocalId; + } - public List<PLMNInfo> getpLMNInfoList() { - return pLMNInfoList; - } + public List<PLMNInfo> getpLMNInfoList() { + return pLMNInfoList; + } - public void setpLMNInfoList(List<PLMNInfo> pLMNInfoList) { - this.pLMNInfoList = pLMNInfoList; - } + public void setpLMNInfoList(List<PLMNInfo> pLMNInfoList) { + this.pLMNInfoList = pLMNInfoList; + } - public GNBCUCPFunction getgNBCUCPFunction() { - return gNBCUCPFunction; - } + public GNBCUCPFunction getgNBCUCPFunction() { + return gNBCUCPFunction; + } - public void setgNBCUCPFunction(GNBCUCPFunction gNBCUCPFunction) { - this.gNBCUCPFunction = gNBCUCPFunction; - } + public void setgNBCUCPFunction(GNBCUCPFunction gNBCUCPFunction) { + this.gNBCUCPFunction = gNBCUCPFunction; + } - public String getResourceType() { - return resourceType; - } + public String getResourceType() { + return resourceType; + } - public void setResourceType(String resourceType) { - this.resourceType = 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 index e93f5aa..4bd9f1c 100644 --- 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 @@ -22,6 +22,7 @@ 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; @@ -35,91 +36,110 @@ 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; - } +@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 index e650ff1..db7c4e0 100644 --- 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 @@ -21,53 +21,54 @@ 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; -import java.sql.Timestamp; @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; + 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 Integer getdLThptPerSlice() { + return dLThptPerSlice; + } - public void setdLThptPerSlice(Integer dLThptPerSlice) { - this.dLThptPerSlice = dLThptPerSlice; - } + public void setdLThptPerSlice(Integer dLThptPerSlice) { + this.dLThptPerSlice = dLThptPerSlice; + } - public Integer getuLThptPerSlice() { - return uLThptPerSlice; - } + public Integer getuLThptPerSlice() { + return uLThptPerSlice; + } - public void setuLThptPerSlice(Integer uLThptPerSlice) { - this.uLThptPerSlice = uLThptPerSlice; - } + public void setuLThptPerSlice(Integer uLThptPerSlice) { + this.uLThptPerSlice = uLThptPerSlice; + } - public Integer getMaxNumberOfConns() { - return maxNumberOfConns; - } + public Integer getMaxNumberOfConns() { + return maxNumberOfConns; + } - public void setMaxNumberOfConns(Integer maxNumberOfConns) { - this.maxNumberOfConns = maxNumberOfConns; - } + public void setMaxNumberOfConns(Integer maxNumberOfConns) { + this.maxNumberOfConns = maxNumberOfConns; + } - public Timestamp getLastUpdatedTS() { - return lastUpdatedTS; - } + public Timestamp getLastUpdatedTS() { + return lastUpdatedTS; + } - public void setLastUpdatedTS(Timestamp lastUpdatedTS) { - this.lastUpdatedTS = 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 1033b3b..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; + private String nodeId; + private String blacklisted; - public NbrDump() { - super(); - // TODO Auto-generated constructor stub - } + public NbrDump() { + super(); + // TODO Auto-generated constructor stub + } - public NbrDump(String nodeId, String blacklisted) { - super(); - this.nodeId = nodeId; - this.blacklisted = blacklisted; - } + public NbrDump(String nodeId, String blacklisted) { + super(); + this.nodeId = nodeId; + this.blacklisted = blacklisted; + } - public String getNodeId() { - return nodeId; - } + public String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } - public String getBlacklisted() { - return blacklisted; - } + public String getBlacklisted() { + return blacklisted; + } - public void setBlacklisted(String blacklisted) { - this.blacklisted = 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 index c2fbd06..5a716e9 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/NearRTRIC.java @@ -22,6 +22,7 @@ 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; @@ -35,100 +36,100 @@ 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; - } + 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 4af3166..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,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; import javax.persistence.EmbeddedId; @@ -27,35 +28,35 @@ import javax.persistence.Table; @Table(name = "NeighborDetails") public class NeighborDetails { - @EmbeddedId - private NeihborId neigbor; + @EmbeddedId + private NeihborId neigbor; - private boolean blacklisted; + private boolean blacklisted; - public NeighborDetails() { + public NeighborDetails() { - } + } - public NeighborDetails(NeihborId neigbor, boolean blacklisted) { - super(); - this.neigbor = neigbor; - this.blacklisted = blacklisted; - } + public NeighborDetails(NeihborId neigbor, boolean blacklisted) { + super(); + this.neigbor = neigbor; + this.blacklisted = blacklisted; + } - public NeihborId getNeigbor() { - return neigbor; - } + public NeihborId getNeigbor() { + return neigbor; + } - public void setNeigbor(NeihborId neigbor) { - this.neigbor = neigbor; - } + public void setNeigbor(NeihborId neigbor) { + this.neigbor = neigbor; + } - public boolean isBlacklisted() { - return blacklisted; - } + public boolean isBlacklisted() { + return blacklisted; + } - public void setBlacklisted(boolean blacklisted) { - this.blacklisted = blacklisted; - } + 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 a18a55b..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; + 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(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 NeighborPmDetails() { + super(); + // TODO Auto-generated constructor stub + } - public String getNbrCellId() { - return nbrCellId; - } + public String getNbrCellId() { + return nbrCellId; + } - public void setNbrCellId(String nbrCellId) { - this.nbrCellId = nbrCellId; - } + public void setNbrCellId(String nbrCellId) { + this.nbrCellId = nbrCellId; + } - public String getKpiName() { - return kpiName; - } + public String getKpiName() { + return kpiName; + } - public void setKpiName(String kpiName) { - this.kpiName = kpiName; - } + public void setKpiName(String kpiName) { + this.kpiName = kpiName; + } - public int getKpiValue() { - return kpiValue; - } + public int getKpiValue() { + return kpiValue; + } - public void setKpiValue(int kpiValue) { - this.kpiValue = 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 3bef66d..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,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.models; import java.io.Serializable; @@ -26,65 +27,65 @@ import javax.persistence.Embeddable; @Embeddable public class NeihborId implements Serializable { - - private static final long serialVersionUID = 1L; - @Column(name = "sourceCellNodeId") - private String sourceCellNodeId; + private static final long serialVersionUID = 1L; + + @Column(name = "sourceCellNodeId") + private String sourceCellNodeId; - @Column(name = "neighborCellNodeId") - private String neighborCell; + @Column(name = "neighborCellNodeId") + private String neighborCell; - public NeihborId() { - } + public NeihborId() { + } - public NeihborId(String sourceCellNodeId, String neighborCell) { - this.sourceCellNodeId = sourceCellNodeId; - this.neighborCell = neighborCell; - } + public NeihborId(String sourceCellNodeId, String neighborCell) { + this.sourceCellNodeId = sourceCellNodeId; + this.neighborCell = neighborCell; + } - public String getSourceCellNodeId() { - return sourceCellNodeId; - } + public String getSourceCellNodeId() { + return sourceCellNodeId; + } - public String getNeighborCell() { - return neighborCell; - } + 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()); - return result; - } + @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()); + return result; + } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - NeihborId other = (NeihborId) obj; - if (neighborCell == null) { - if (other.neighborCell != null) { - return false; - } - } else if (!neighborCell.equals(other.neighborCell)) - return false; - if (sourceCellNodeId == null) { - if (other.sourceCellNodeId != null) { - return false; - } - } else if (!sourceCellNodeId.equals(other.sourceCellNodeId)) { - return false; - } - return true; - } -}
\ No newline at end of file + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + NeihborId other = (NeihborId) obj; + if (neighborCell == null) { + if (other.neighborCell != null) { + return false; + } + } else if (!neighborCell.equals(other.neighborCell)) + return false; + if (sourceCellNodeId == null) { + if (other.sourceCellNodeId != null) { + return false; + } + } else if (!sourceCellNodeId.equals(other.sourceCellNodeId)) { + return false; + } + return true; + } +} 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 e0a1dc9..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,8 +25,8 @@ import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.Id; import javax.persistence.FetchType; +import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -34,66 +34,66 @@ import javax.persistence.Table; @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,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 - */ - 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; - } + @Id + @Column(name = "serverId", unique = true, nullable = false, length = 20) + private String serverId; + + private String ip; + private String netconfPort; + + @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 + */ + 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 5d6e82e..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,83 +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; - - public int getRowId() { - return rowId; - } - - public void setRowId(int rowId) { - this.rowId = rowId; - } - - public long getTime() { - return time; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - 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; - } + @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; + + public int getRowId() { + return rowId; + } + + public void setRowId(int rowId) { + this.rowId = rowId; + } + + public long getTime() { + return time; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + 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 index a45ad77..a7121bd 100644 --- 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 @@ -36,28 +36,28 @@ import javax.persistence.Table; @Embeddable @Table(name = "PLMNINFO") public class PLMNInfo implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Column(name = "PLMNID") - private String pLMNId; + @Column(name = "PLMNID") + private String pLMNId; - @Embedded - private SNSSAI sNSSAI; + @Embedded + private SNSSAI sNSSAI; - public String getpLMNId() { - return pLMNId; - } + public String getpLMNId() { + return pLMNId; + } - public void setpLMNId(String pLMNId) { - this.pLMNId = pLMNId; - } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } - public SNSSAI getsNSSAI() { - return sNSSAI; - } + public SNSSAI getsNSSAI() { + return sNSSAI; + } - public void setsNSSAI(SNSSAI sNSSAI) { - this.sNSSAI = 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 index af16d44..fd674bc 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/PLMNInfoModel.java @@ -21,94 +21,93 @@ 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; - } + 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 9f0ad6e..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 @@ -24,24 +24,24 @@ import java.util.List; public class PmDataDump { - private List<PmParameters> kpiDump; + private List<PmParameters> kpiDump; - public PmDataDump() { - super(); - // TODO Auto-generated constructor stub - } + public PmDataDump() { + super(); + // TODO Auto-generated constructor stub + } - public PmDataDump(List<PmParameters> kpiDump) { - super(); - this.kpiDump = kpiDump; - } + public PmDataDump(List<PmParameters> kpiDump) { + super(); + this.kpiDump = kpiDump; + } - public List<PmParameters> getKpiDump() { - return kpiDump; - } + public List<PmParameters> getKpiDump() { + return kpiDump; + } - public void setKpiDump(List<PmParameters> kpiDump) { - this.kpiDump = 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 6ff4721..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 @@ -22,77 +22,77 @@ package org.onap.ransim.rest.api.models; public class PmParameters { - private String parameter1; - private String successValue1; - private String badValue1; - private String poorValue1; - private String parameter2; - 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; - } + private String parameter1; + private String successValue1; + private String badValue1; + private String poorValue1; + private String parameter2; + 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 index 5ec30c8..b42cd51 100644 --- 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 @@ -22,6 +22,7 @@ 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; @@ -35,106 +36,106 @@ 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 + "]"; - } + 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 index aced9cf..7e8d1bb 100644 --- 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 @@ -21,6 +21,7 @@ package org.onap.ransim.rest.api.models; import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -30,36 +31,36 @@ 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; + 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 String getpLMNId() { + return pLMNId; + } - public void setpLMNId(String pLMNId) { - this.pLMNId = pLMNId; - } + public void setpLMNId(String pLMNId) { + this.pLMNId = pLMNId; + } - public String getsNSSAI() { - return sNSSAI; - } + public String getsNSSAI() { + return sNSSAI; + } - public void setsNSSAI(String sNSSAI) { - this.sNSSAI = sNSSAI; - } + public void setsNSSAI(String sNSSAI) { + this.sNSSAI = sNSSAI; + } - public RRMPolicyRatio getRrmPolicy() { - return rrmPolicy; - } + public RRMPolicyRatio getRrmPolicy() { + return rrmPolicy; + } - public void setRrmPolicy(RRMPolicyRatio rrmPolicy) { - this.rrmPolicy = 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 index 27c5d9c..33546c3 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/models/RRMPolicyRatio.java @@ -22,6 +22,7 @@ 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; @@ -33,98 +34,97 @@ 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; - } + 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 index 1c35546..e33a871 100644 --- 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 @@ -21,6 +21,7 @@ package org.onap.ransim.rest.api.models; import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.Embedded; @@ -32,57 +33,57 @@ 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; - } + 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 1738e65..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 @@ -22,28 +22,28 @@ package org.onap.ransim.rest.api.models; public class SetCollisionReq { - private boolean collision; + private boolean collision; - /** - * A constructor for SetCollisionReq. - * - * @param collision to set if the new simulation has collision between the cells - */ - public SetCollisionReq(boolean collision) { - super(); - this.collision = collision; - } + /** + * A constructor for SetCollisionReq. + * + * @param collision to set if the new simulation has collision between the cells + */ + public SetCollisionReq(boolean collision) { + super(); + this.collision = collision; + } - public SetCollisionReq() { + public SetCollisionReq() { - } + } - public boolean isCollision() { - return collision; - } + public boolean isCollision() { + return collision; + } - public void setCollision(boolean collision) { - this.collision = collision; - } + public void setCollision(boolean collision) { + this.collision = collision; + } } 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 bd99dee..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 @@ -22,87 +22,87 @@ package org.onap.ransim.rest.api.models; public class SetConstants { - private int gridSize; - private int gridType; - private boolean collision; - - private int processCapacity; - private int numberOfMachines; - private String serverIdPrefix; - - public 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 - */ - public SetConstants(int gridSize, int gridType, boolean collision, int processCapacity, int numberOfMachines, - String serverIdPrefix) { - super(); - this.gridSize = gridSize; - this.gridType = gridType; - this.collision = collision; - this.processCapacity = processCapacity; - this.numberOfMachines = numberOfMachines; - this.serverIdPrefix = serverIdPrefix; - } - - public int getGridSize() { - return gridSize; - } - - public void setGridSize(int gridSize) { - this.gridSize = gridSize; - } - - public int getGridType() { - return gridType; - } - - public void setGridType(int gridType) { - this.gridType = gridType; - } - - public boolean isCollision() { - return collision; - } - - public void setCollision(boolean collision) { - this.collision = collision; - } - - public int getProcessCapacity() { - return processCapacity; - } - - public void setProcessCapacity(int processCapacity) { - this.processCapacity = processCapacity; - } - - public int getNumberOfMachines() { - return numberOfMachines; - } - - public void setNumberOfMachines(int numberOfMachines) { - this.numberOfMachines = numberOfMachines; - } - - public String getServerIdPrefix() { - return serverIdPrefix; - } - - public void setServerIdPrefix(String serverIdPrefix) { - this.serverIdPrefix = serverIdPrefix; - } + private int gridSize; + private int gridType; + private boolean collision; + + private int processCapacity; + private int numberOfMachines; + private String serverIdPrefix; + + public 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 + */ + public SetConstants(int gridSize, int gridType, boolean collision, int processCapacity, int numberOfMachines, + String serverIdPrefix) { + super(); + this.gridSize = gridSize; + this.gridType = gridType; + this.collision = collision; + this.processCapacity = processCapacity; + this.numberOfMachines = numberOfMachines; + this.serverIdPrefix = serverIdPrefix; + } + + public int getGridSize() { + return gridSize; + } + + public void setGridSize(int gridSize) { + this.gridSize = gridSize; + } + + public int getGridType() { + return gridType; + } + + public void setGridType(int gridType) { + this.gridType = gridType; + } + + public boolean isCollision() { + return collision; + } + + public void setCollision(boolean collision) { + this.collision = collision; + } + + public int getProcessCapacity() { + return processCapacity; + } + + public void setProcessCapacity(int processCapacity) { + this.processCapacity = processCapacity; + } + + public int getNumberOfMachines() { + return numberOfMachines; + } + + public void setNumberOfMachines(int numberOfMachines) { + this.numberOfMachines = numberOfMachines; + } + + public String getServerIdPrefix() { + return serverIdPrefix; + } + + public void setServerIdPrefix(String serverIdPrefix) { + this.serverIdPrefix = 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 index d8f280b..c65a22e 100644 --- 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 @@ -22,6 +22,7 @@ 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; @@ -34,141 +35,141 @@ 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; - } + 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 index 37ff491..40ab024 100644 --- 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 @@ -30,31 +30,31 @@ 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 + "]"; - } + 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 faf7c54..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 @@ -23,84 +23,84 @@ package org.onap.ransim.rest.api.models; import java.util.List; public class Topology { - int gridSize; - float minScreenX = 0; - float minScreenY = 0; - float maxScreenX = 10; - float maxScreenY = 10; - List<CellDetails> cellTopology; - - /** - * 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 - */ - public Topology(int gridSize, float minScreenX, float minScreenY, float maxScreenX, float maxScreenY, - List<CellDetails> cellTopology) { - super(); - this.gridSize = gridSize; - this.minScreenX = minScreenX; - this.minScreenY = minScreenY; - this.maxScreenX = maxScreenX; - this.maxScreenY = maxScreenY; - this.cellTopology = cellTopology; - } - - public Topology() { - - } - - public int getGridSize() { - return gridSize; - } - - public void setGridSize(int gridSize) { - this.gridSize = gridSize; - } - - public float getMinScreenX() { - return minScreenX; - } - - public void setMinScreenX(float minScreenX) { - this.minScreenX = minScreenX; - } - - public float getMinScreenY() { - return minScreenY; - } - - public void setMinScreenY(float minScreenY) { - this.minScreenY = minScreenY; - } - - public float getMaxScreenX() { - return maxScreenX; - } - - public void setMaxScreenX(float maxScreenX) { - this.maxScreenX = maxScreenX; - } - - public float getMaxScreenY() { - return maxScreenY; - } - - public void setMaxScreenY(float maxScreenY) { - this.maxScreenY = maxScreenY; - } - - public List<CellDetails> getCellTopology() { - return cellTopology; - } - - public void setCellTopology(List<CellDetails> cellTopology) { - this.cellTopology = cellTopology; - } + int gridSize; + float minScreenX = 0; + float minScreenY = 0; + float maxScreenX = 10; + float maxScreenY = 10; + List<CellDetails> cellTopology; + + /** + * 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 + */ + public Topology(int gridSize, float minScreenX, float minScreenY, float maxScreenX, float maxScreenY, + List<CellDetails> cellTopology) { + super(); + this.gridSize = gridSize; + this.minScreenX = minScreenX; + this.minScreenY = minScreenY; + this.maxScreenX = maxScreenX; + this.maxScreenY = maxScreenY; + this.cellTopology = cellTopology; + } + + public Topology() { + + } + + public int getGridSize() { + return gridSize; + } + + public void setGridSize(int gridSize) { + this.gridSize = gridSize; + } + + public float getMinScreenX() { + return minScreenX; + } + + public void setMinScreenX(float minScreenX) { + this.minScreenX = minScreenX; + } + + public float getMinScreenY() { + return minScreenY; + } + + public void setMinScreenY(float minScreenY) { + this.minScreenY = minScreenY; + } + + public float getMaxScreenX() { + return maxScreenX; + } + + public void setMaxScreenX(float maxScreenX) { + this.maxScreenX = maxScreenX; + } + + public float getMaxScreenY() { + return maxScreenY; + } + + public void setMaxScreenY(float maxScreenY) { + this.maxScreenY = maxScreenY; + } + + public List<CellDetails> getCellTopology() { + return cellTopology; + } + + public void setCellTopology(List<CellDetails> cellTopology) { + this.cellTopology = 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 b2aefec..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 @@ -24,28 +24,28 @@ import java.util.List; public class TopologyDump { - private List<CellData> cellList; + private List<CellData> cellList; - /** - * A constructor for TopologyDump. - * - * @param cellList list of cells - */ - public TopologyDump(List<CellData> cellList) { + /** + * A constructor for TopologyDump. + * + * @param cellList list of cells + */ + public TopologyDump(List<CellData> cellList) { - this.cellList = cellList; - } + this.cellList = cellList; + } - public TopologyDump() { + public TopologyDump() { - } + } - public List<CellData> getCellList() { - return cellList; - } + public List<CellData> getCellList() { + return cellList; + } - public void setCellList(List<CellData> cellList) { - this.cellList = cellList; - } + public void setCellList(List<CellData> cellList) { + this.cellList = 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 index 48e20bf..da7e8d6 100644 --- 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 @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.repository; import java.util.List; @@ -29,9 +30,9 @@ 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(); + @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 index 99b620a..87134b2 100644 --- 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 @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.repository; import org.onap.ransim.rest.api.models.CellNeighbor; 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 index 06bf630..d9e028f 100644 --- 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 @@ -22,18 +22,20 @@ 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; -import org.onap.ransim.rest.api.models.GNBCUCPFunction; - @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 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); + @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 index 62d76e6..8bb2ad2 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/repository/GNBCUUPRepository.java @@ -20,11 +20,11 @@ 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; -import org.onap.ransim.rest.api.models.GNBCUUPFunction; @Repository -public interface GNBCUUPRepository extends CrudRepository<GNBCUUPFunction,Integer>{ +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 index eec816d..29a7a8c 100644 --- 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 @@ -21,14 +21,16 @@ 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; -import org.onap.ransim.rest.api.models.GNBDUFunction; @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); +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 index 7cb3629..cbad231 100644 --- 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 @@ -20,11 +20,11 @@ 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; -import org.onap.ransim.rest.api.models.NRCellCU; @Repository -public interface NRCellCURepository extends CrudRepository<NRCellCU,Integer>{ - +public interface NRCellCURepository extends CrudRepository<NRCellCU, 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 index dee5b17..8ed4882 100644 --- 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 @@ -22,23 +22,26 @@ 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; -import org.onap.ransim.rest.api.models.NearRTRIC; @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); +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 index 7209f40..0493a10 100644 --- 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 @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.repository; import org.onap.ransim.rest.api.models.NeighborDetails; 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 index e0ecc03..2e0ae32 100644 --- 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 @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.repository; import org.onap.ransim.rest.api.models.NetconfServers; 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 index 0541fec..8e900f5 100644 --- 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 @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.ransim.rest.api.repository; import org.onap.ransim.rest.api.models.OperationLog; @@ -24,6 +25,6 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository -public interface OperationLogRepo extends CrudRepository<OperationLog, String>{ +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 index 7b41e9e..8972732 100644 --- 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 @@ -20,14 +20,15 @@ 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; -import org.onap.ransim.rest.api.models.RANSliceInfo; - @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); +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 index 365869d..d0b0b25 100644 --- 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 @@ -20,12 +20,11 @@ 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; -import org.onap.ransim.rest.api.models.RRMPolicyMember; - @Repository -public interface RRMPolicyMemberRepository extends CrudRepository<RRMPolicyMember,Integer>{ +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 index 1cb786a..880381f 100644 --- 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 @@ -20,16 +20,15 @@ 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; -import org.onap.ransim.rest.api.models.RRMPolicyRatio; - @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); +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 index 7f706ef..6db7626 100644 --- 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 @@ -23,7 +23,6 @@ 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>{ +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 index 9a0a70d..92ccd1a 100644 --- 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 @@ -20,16 +20,16 @@ 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; -import org.onap.ransim.rest.api.models.TACells; /*** - * + * * @author onapadmin * */ @Repository -public interface TACellRepository extends CrudRepository <TACells,String> { - +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 index d7e4b5d..7e2172b 100644 --- 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 @@ -32,9 +32,6 @@ import java.util.stream.Collectors; import org.apache.log4j.Logger; import org.modelmapper.ModelMapper; import org.modelmapper.convention.MatchingStrategies; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - import org.onap.ransim.rest.api.models.GNBCUCPFunction; import org.onap.ransim.rest.api.models.GNBCUUPFunction; import org.onap.ransim.rest.api.models.GNBDUFunction; @@ -63,574 +60,601 @@ 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; - } - + 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 index a06f3c7..6197751 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/RansimControllerServices.java @@ -20,6 +20,8 @@ package org.onap.ransim.rest.api.services; +import com.google.gson.Gson; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -42,1039 +44,1016 @@ 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.TopologyDump; -import org.onap.ransim.rest.api.models.RRMPolicyRatio; 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.PLMNInfoRepo; 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.model.ConfigPLMNInfo; -import org.onap.ransim.websocket.model.SNSSAI; -import org.onap.ransim.websocket.model.ConfigData; import org.onap.ransim.websocket.server.RansimWebSocketServer; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import org.onap.ransim.rest.web.mapper.NearRTRICModel; -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.NRCellDUModel; -import org.onap.ransim.rest.web.mapper.NRCellCUModel; -import org.onap.ransim.rest.web.mapper.PLMNInfoModel; -import org.onap.ransim.rest.web.mapper.RRMPolicyRatioModel; -import org.onap.ransim.rest.web.mapper.NSSAIData; -import org.onap.ransim.rest.api.models.NSSAIConfig; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; - 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; -import com.google.gson.Gson; -import org.onap.ransim.websocket.model.*; -import org.onap.ransim.netconf.NetconfClient; - @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 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))); + 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 = 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"); + 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"); + } 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()); + 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()); } - for(GNBDUModel gNBDUModel:rtricModel.getgNBDUList()) - { - gNBList.add(gNBDUModel.getgNBDUId().toString()); - setRanNetconfServers(gNBDUModel.getgNBDUId().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); } - 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, + 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); - } + } 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], + /** + * 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], + + } 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 { + 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; } - 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)); - } - } - } - } + + 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); } - - } - catch (Exception eu) { - log.info("Exception:", eu); - } - - } - - /** + + } + + /** * Gets the initial config tree from the database. */ - private void getInitalConfigTree(NearRTRICModel rtRicModel,String serverId) { + 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); - } + 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); + 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); @@ -1082,114 +1061,113 @@ public class RansimControllerServices { String ipPortKey = serverIdIpPortMapping.get(serverId); log.info("sendInitialConfig: ipPortKey:" + ipPortKey); - - Gson gson = new Gson(); - String jsonStr = gson.toJson(ranNetwork); + + 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 session = webSocketSessions.get(ipPortKey); - RansimWebSocketServer.sendSetConfigTopologyMessage(jsonStr, session); + 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(); + } - /** - * 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); + /** + * 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<>(); @@ -1197,331 +1175,327 @@ public class RansimControllerServices { 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); + 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(); + 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 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 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, + 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); - } - } + } 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"); - } - } - } + 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 index e51af6f..ecc76b3 100644 --- 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 @@ -23,6 +23,7 @@ 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; @@ -40,225 +41,241 @@ import org.springframework.stereotype.Service; @Service public class RansimRepositoryService { - static Logger log = Logger.getLogger(RansimRepositoryService.class.getName()); + static Logger log = Logger.getLogger(RansimRepositoryService.class.getName()); - @Autowired - CellDetailsRepo cellDetailsRepo; + @Autowired + CellDetailsRepo cellDetailsRepo; - @Autowired - NetconfServersRepo netconfServersRepo; + @Autowired + NetconfServersRepo netconfServersRepo; - @Autowired - CellNeighborRepo cellNeighborRepo; + @Autowired + CellNeighborRepo cellNeighborRepo; - @Autowired - NeighborDetailsRepo neighborDetailsRepo; + @Autowired + NeighborDetailsRepo neighborDetailsRepo; - @Autowired - OperationLogRepo operationLogRepo; + @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 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 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 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 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 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 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 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 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 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) { + /** + * 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()); - } + 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 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 netconf servers + */ + public void deleteNetconfServers() { + netconfServersRepo.deleteAll(); + } - /** - * Method to delete all cell neighbors - */ - public void deleteCellNeighbors() { - cellNeighborRepo.deleteAll(); - } + /** + * Method to delete all cell neighbors + */ + public void deleteCellNeighbors() { + cellNeighborRepo.deleteAll(); + } - /** - * Method to delete all cells - */ - public void deleteAllCellDetails() { - cellDetailsRepo.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 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 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 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 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); - } + /** + * 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 index c03d439..1a74c25 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/rest/api/services/SlicingPMDataGenerator.java @@ -1,261 +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 java.util.Collection;
-import java.util.Set;
-
-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.Map;
-import java.util.Random;
-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 java.io.ByteArrayOutputStream;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-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.apache.log4j.Logger;
-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;
-
-import com.google.gson.Gson;
-
-@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 ");
- }
- }
-}
-
+/*- + * ============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 cee94df..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,60 +20,57 @@ package org.onap.ransim.rest.client; -import java.nio.charset.Charset; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; -import org.eclipse.persistence.internal.oxm.conversion.Base64; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; - +import java.io.*; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import javax.net.ssl.HttpsURLConnection; import java.net.URL; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLSession; -import org.slf4j.LoggerFactory; - +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 javax.net.ssl.*; -import java.io.*; -import java.security.KeyStore; -import java.security.MessageDigest; -import java.security.cert.CertificateException; -import org.apache.http.client.HttpClient; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; + 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.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.apache.http.impl.client.HttpClientBuilder; +import org.springframework.web.client.RestTemplate; public class RestClient { -private static class NullHostnameVerifier implements HostnameVerifier { - public boolean verify(String hostname, SSLSession session) { - return true; - } + private static class NullHostnameVerifier implements HostnameVerifier { + public boolean verify(String hostname, SSLSession session) { + return true; } - private static class SavingTrustManager implements X509TrustManager { + } + private static class SavingTrustManager implements X509TrustManager { private final X509TrustManager tm; private X509Certificate[] chain; @@ -85,16 +82,14 @@ private static class NullHostnameVerifier implements HostnameVerifier { public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; - + } - public void checkClientTrusted(X509Certificate[] chain, String authType) - throws CertificateException { + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { throw new UnsupportedOperationException(); } - public void checkServerTrusted(X509Certificate[] chain, String authType) - throws CertificateException { + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { this.chain = chain; tm.checkServerTrusted(chain, authType); } @@ -120,142 +115,131 @@ private static class NullHostnameVerifier implements HostnameVerifier { * 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, + + public String sendMountRequestToSdnr(String serverId, String ip, int port, String agentIp, String agentPort, String agentUsername, String 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); - 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>"; + HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build(); + ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); - - 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); - - 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); + 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("Started SSL handshake without hostname verifier..."); - - RestTemplate restTemplate = new RestTemplate(requestFactory); - HttpClientBuilder httpClientBuilder = HttpClients.custom() - .setSSLContext(SSLContext.getDefault()) - .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) - .useSystemProperties(); + log.info("Using Authorization"); - restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build())); + SSLSocket socket = (SSLSocket) factory.createSocket(ip, port); + socket.setSoTimeout(10000); + try { + socket.startHandshake(); + } catch (SSLException e) { - HttpHeaders headers = createHeaders(agentUsername, agentPassword); + log.error("Exc insocket handshake", e); - 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("Started SSL handshake without hostname verifier..."); - log.info("Request sent, result: " + result); - socket.close(); + 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()); } - catch (SSLException e) { - System.out.println(); - e.printStackTrace(System.out); - } + 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); - catch (Exception e) { + log.info("Request sent, result: " + result); + socket.close(); + } catch (SSLException e) { + System.out.println(); + e.printStackTrace(System.out); + } + + catch (Exception e) { - log.error("Exc in post {}", e); - } - return result.toString(); + log.error("Exc in post {}", e); + } + return result.toString(); } /** * 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 aafb0b3..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 @@ -42,50 +42,50 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 -@ComponentScan(basePackages = { "org.onap.*", "com.*" }) +@ComponentScan(basePackages = {"org.onap.*", "com.*"}) public class RansimRestConfig { - private static final Logger log = Logger.getLogger(RansimRestConfig.class); + private static final Logger log = Logger.getLogger(RansimRestConfig.class); - /** - * init. - */ - @PostConstruct - public void init() { - Properties prop = new Properties(); - try (InputStream input = new FileInputStream("rs.properties")) { - // load a properties file - prop.load(input); - } catch (Exception e) { - log.error("Exception Occured while loading properties file : {} ", e); - } - } + /** + * init. + */ + @PostConstruct + public void init() { + Properties prop = new Properties(); + try (InputStream input = new FileInputStream("rs.properties")) { + // load a properties file + prop.load(input); + } catch (Exception e) { + log.error("Exception Occured while loading properties file : {} ", e); + } + } - 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(); - } + 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(); + } - /** - * ransimappApi . - * - * @return returns api info - */ - @Bean - public Docket ransimappApi() { - return new Docket(DocumentationType.SWAGGER_2).select() - .apis(RequestHandlerSelectors.basePackage("org.onap.ransim.rest.api")).paths(PathSelectors.any()) - .build().apiInfo(apiInfo()); - } + /** + * ransimappApi . + * + * @return returns api info + */ + @Bean + public Docket ransimappApi() { + return new Docket(DocumentationType.SWAGGER_2).select() + .apis(RequestHandlerSelectors.basePackage("org.onap.ransim.rest.api")).paths(PathSelectors.any()) + .build().apiInfo(apiInfo()); + } - /** - * MultipartConfigElement. - * - * @return returns MultipartConfigElement - */ - @Bean - public MultipartConfigElement multipartConfigElement() { - String location = System.getProperty("java.io.tmpdir"); - return new MultipartConfigElement(location); - } + /** + * MultipartConfigElement. + * + * @return returns MultipartConfigElement + */ + @Bean + public MultipartConfigElement multipartConfigElement() { + String location = System.getProperty("java.io.tmpdir"); + return new MultipartConfigElement(location); + } } 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 index 5e8ca87..ae8ffea 100644 --- 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 @@ -21,94 +21,94 @@ 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; - } + 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 index 3b8370b..44a2777 100644 --- 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 @@ -24,14 +24,14 @@ import java.util.List; public class CellInputPayload { - List<CellObj> cellList; + List<CellObj> cellList; - public List<CellObj> getCellList() { - return cellList; - } + public List<CellObj> getCellList() { + return cellList; + } - public void setCellList(List<CellObj> cellList) { - this.cellList = 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 index cfd5554..65d9a9f 100644 --- 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 @@ -20,58 +20,49 @@ package org.onap.ransim.rest.web.mapper; -import javax.persistence.Column; - 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; - } - - - + + @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 index 7214456..f4bb6cf 100644 --- 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 @@ -20,29 +20,31 @@ package org.onap.ransim.rest.web.mapper; -import java.util.List; - 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; - } + @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 index 03cebc5..8e7c77d 100644 --- 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 @@ -21,28 +21,30 @@ 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; - } - + + 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 index 09ca96e..605e2df 100644 --- 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 @@ -21,30 +21,35 @@ 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 + "]"; - } + 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 index 6e1d143..1d538b6 100644 --- 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 @@ -22,61 +22,76 @@ 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 + "]"; - } - +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 index 979e9d1..4b750b0 100644 --- 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 @@ -25,68 +25,85 @@ 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 + "]"; - } - +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 index 9b0b48d..8e2ba96 100644 --- 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 @@ -22,69 +22,84 @@ 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 + "]"; - } +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 index 5fe59d9..0ee438b 100644 --- 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 @@ -22,31 +22,38 @@ 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 + "]"; - } +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 index 5340eeb..3e3576a 100644 --- 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 @@ -24,80 +24,95 @@ 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 + "]"; - } - - - } +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 index 0b3681f..c49d1c8 100644 --- 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 @@ -1,57 +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 + "]";
- }
-}
+/* + * ============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 index 364795e..d114a08 100644 --- 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 @@ -20,44 +20,53 @@ 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; - } +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 index 8b207b3..995c503 100644 --- 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 @@ -23,32 +23,34 @@ 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; - } - - + // 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 index 24c0296..00dc861 100644 --- 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 @@ -20,38 +20,40 @@ package org.onap.ransim.rest.web.mapper; -import java.util.List; - 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; - }*/ - - + + 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 index b13f7fd..ee0f786 100644 --- 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 @@ -23,32 +23,34 @@ 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; - } - - + // 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 index 8cce96d..6d7448a 100644 --- 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 @@ -18,32 +18,34 @@ * ============LICENSE_END========================================================= */ - -package org.onap.ransim.rest.web.mapper; +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; - } - - + + 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 index 9fd8f38..df15cf8 100644 --- 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 @@ -21,22 +21,23 @@ 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; - } - - + 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 index 57ec2d8..c29abda 100644 --- 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 @@ -22,76 +22,94 @@ 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 - + "]"; - } +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 index 6bbc0ca..3bddf1a 100644 --- 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 @@ -20,25 +20,29 @@ 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 + "]"; - } - +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 index d04caad..610309b 100644 --- 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 @@ -23,77 +23,96 @@ 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 + "]"; - } - +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 index 7d613f5..df9ccfa 100644 --- 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 @@ -20,24 +20,28 @@ package org.onap.ransim.rest.web.mapper; -public class RRMPolicyMemberModel{ - private String pLMNId; - private NSSAIData sNSSAI; +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 + "]"; - } + 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 index 2a78238..9c89b5e 100644 --- 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 @@ -22,76 +22,95 @@ 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 + "]"; - } - +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 index 20b08fc..8b0ba3c 100644 --- 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 @@ -24,35 +24,35 @@ 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; - } + // 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 index c1f45dd..c7be576 100644 --- 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 @@ -22,91 +22,113 @@ 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 + "]"; - } +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 index 75c0ea0..97abfbb 100644 --- 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 @@ -1,51 +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 + "]";
- }
-}
-
+/* + * ============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 index dd1adac..ef8634f 100644 --- 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 @@ -1,97 +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 + "]";
- }
-}
-
+/* + * ============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 index 55c091d..f5f4fad 100644 --- 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 @@ -1,58 +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 + "]";
- }
-}
-
+/* + * ============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 index 7defc65..ec18cf3 100644 --- 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 @@ -1,64 +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 + "]";
- }
-}
-
+/* + * ============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 index 9999933..1f1bfd8 100644 --- 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 @@ -1,54 +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 + "]";
- }
-
-}
-
+/* + * ============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 index f8b43c7..fe43701 100644 --- 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 @@ -1,71 +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 + "]";
- }
-
-}
-
+/* + * ============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 index c8bb913..5052536 100644 --- 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 @@ -1,53 +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 + "]";
- }
-}
-
+/* + * ============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 index f78f9c5..534eaae 100644 --- 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 @@ -1,40 +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;
- }
-}
-
+/* + * ============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 index 5fdc2b2..bfc5c31 100644 --- 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 @@ -1,76 +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
- + "]";
- }
-}
-
+/* + * ============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 index 6eace2d..e57a010 100644 --- 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 @@ -1,64 +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 + "]";
- }
-
-}
-
+/* + * ============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 index 9921bdf..54da288 100644 --- 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 @@ -1,108 +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 + "]";
- }
-}
-
+/* + * ============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 index addd082..c3983c1 100644 --- 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 @@ -1,39 +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() {
- }
-
-}
-
+/* + * ============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 index aac1b76..94f8826 100644 --- 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 @@ -1,66 +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 + "]";
- }
-
-}
-
+/* + * ============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 index 76ddae4..3530dd9 100644 --- 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 @@ -1,77 +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 + "]";
- }
-
-}
-
+/* + * ============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 index 9e86e6d..aec88e3 100644 --- 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 @@ -1,51 +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 + "]";
- }
-
-}
-
+/* + * ============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 index 2e71f5a..cbaf121 100644 --- 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 @@ -1,65 +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 + "]";
- }
-
-}
-
+/* + * ============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 index a4546bc..48804e6 100644 --- 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 @@ -17,39 +17,40 @@ * 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 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 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))); - } + /** + * @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 a822385..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 @@ -25,23 +25,23 @@ import java.util.Map; public class AdditionalMeasurements { - private String name; - private Map<String, String> hashMap = new HashMap<String, String>(); + private String name; + private Map<String, String> hashMap = new HashMap<String, String>(); - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public Map<String, String> getHashMap() { - return hashMap; - } + public Map<String, String> getHashMap() { + return hashMap; + } - public void setHashMap(Map<String, String> hashMap) { - this.hashMap = hashMap; - } + 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 index f875f10..686ba37 100644 --- 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 @@ -20,47 +20,55 @@ package org.onap.ransim.websocket.model; -import com.fasterxml.jackson.annotation.JsonProperty; 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 gNBId; private String operationalState; private String cellState; private String gNBCUUPId; - + public String getLocationName() { - return locationName; + return locationName; } + public void setLocationName(String locationName) { - this.locationName = locationName; + this.locationName = locationName; } + public String getgNBId() { - return gNBId; + return gNBId; } + public void setgNBId(String gNBId) { - this.gNBId = gNBId; + this.gNBId = gNBId; } + public String getOperationalState() { - return operationalState; + return operationalState; } + public void setOperationalState(String operationalState) { - this.operationalState = operationalState; + this.operationalState = operationalState; } + public String getCellState() { - return cellState; + return cellState; } + public void setCellState(String cellState) { - this.cellState = cellState; - } + this.cellState = cellState; + } + public String getgNBCUUPId() { - return gNBCUUPId; + return gNBCUUPId; } + public void setgNBCUUPId(String gNBCUUPId) { - this.gNBCUUPId = 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 c6bf224..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 @@ -22,65 +22,65 @@ 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(); - this.sourceName = sourceName; - this.sourceUuid = sourceUuid; - this.reportingEntityName = reportingEntityName; - 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; - } + 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(); + this.sourceName = sourceName; + this.sourceUuid = sourceUuid; + this.reportingEntityName = reportingEntityName; + 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 dc87d50..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 @@ -22,41 +22,41 @@ package org.onap.ransim.websocket.model; public class CommonEventHeaderPm { - private String sourceName; - private String sourceUuid; - private long startEpochMicrosec; - private long 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; - } + private String sourceName; + private String sourceUuid; + private long startEpochMicrosec; + private long 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; + } } 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 index 859b51d..a3770d5 100644 --- 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 @@ -1,53 +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;
- }
-}
+/* + * ============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 index b857829..7f8eba2 100644 --- 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 @@ -1,58 +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() {
-
- }
-}
+/* + * ============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 de3c9d8..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 @@ -24,24 +24,24 @@ import java.io.Serializable; public class DeviceData implements Serializable { - private static final long serialVersionUID = 4388248209444904611L; + private static final long serialVersionUID = 4388248209444904611L; - private String type; - private String message; + private String type; + private String message; - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setMessage(String message) { - this.message = message; - } + public void setMessage(String message) { + this.message = message; + } - public String getMessage() { - return message; - } -}
\ No newline at end of file + public String getMessage() { + return message; + } +} 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 084a01b..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 @@ -26,30 +26,30 @@ import javax.websocket.EndpointConfig; 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(); - String[] strInfo = msgInfo.split(":", 2); - if (strInfo.length < 2) { - data.setMessage(""); - } else { - data.setMessage(strInfo[1]); - } - data.setType(strInfo[0]); - return data; - } - - @Override - public boolean willDecode(String arg0) { - return true; - } + @Override + public void destroy() { + } + + @Override + public void init(EndpointConfig arg0) { + } + + @Override + public DeviceData decode(String msgInfo) throws DecodeException { + DeviceData data = new DeviceData(); + String[] strInfo = msgInfo.split(":", 2); + if (strInfo.length < 2) { + data.setMessage(""); + } else { + data.setMessage(strInfo[1]); + } + data.setType(strInfo[0]); + return data; + } + + @Override + public boolean willDecode(String arg0) { + 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 c3f1ff0..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 @@ -26,22 +26,22 @@ import javax.websocket.EndpointConfig; public class DeviceDataEncoder implements Encoder.Text<DeviceData> { - @Override - public void destroy() { - // TODO Auto-generated method stub + @Override + public void destroy() { + // TODO Auto-generated method stub - } + } - @Override - public void init(EndpointConfig arg0) { - // 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; - } + @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 b89f967..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 @@ -22,34 +22,34 @@ 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; - } + 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 f9e2f8b..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 @@ -22,23 +22,23 @@ package org.onap.ransim.websocket.model; public class EventPm { - private CommonEventHeaderPm commonEventHeader; - private Measurement measurement; + private CommonEventHeaderPm commonEventHeader; + private Measurement measurement; - public CommonEventHeaderPm getCommonEventHeader() { - return commonEventHeader; - } + public CommonEventHeaderPm getCommonEventHeader() { + return commonEventHeader; + } - public void setCommonEventHeader(CommonEventHeaderPm commonEventHeader) { - this.commonEventHeader = commonEventHeader; - } + public void setCommonEventHeader(CommonEventHeaderPm commonEventHeader) { + this.commonEventHeader = commonEventHeader; + } - public Measurement getMeasurement() { - return measurement; - } + public Measurement getMeasurement() { + return measurement; + } - public void setMeasurement(Measurement measurement) { - this.measurement = 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 4d9b1e8..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 @@ -24,64 +24,64 @@ 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(); - } - - public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, String eventSeverity, - Map<String, String> alarmAdditionalInformation) { - super(); - this.alarmCondition = alarmCondition; - this.eventSourceType = eventSourceType; - this.specificProblem = specificProblem; - 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; - } + private String alarmCondition; + private String eventSourceType; + private String specificProblem; + private String eventSeverity; + private Map<String, String> alarmAdditionalInformation; + + public FaultFields() { + super(); + } + + public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, String eventSeverity, + Map<String, String> alarmAdditionalInformation) { + super(); + this.alarmCondition = alarmCondition; + this.eventSourceType = eventSourceType; + this.specificProblem = specificProblem; + 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 ceb5922..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 @@ -24,14 +24,14 @@ import java.util.List; public class FmMessage { - List<EventFm> fmEventList; + List<EventFm> fmEventList; - public void setFmEventList(List<EventFm> data) { - this.fmEventList = data; - } + public void setFmEventList(List<EventFm> data) { + this.fmEventList = data; + } - public List<EventFm> getFmEventList() { - return fmEventList; - } + 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 index 40518de..cee385b 100644 --- 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 @@ -26,26 +26,27 @@ import com.fasterxml.jackson.annotation.JsonInclude; 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() - { - + + 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 index 96860c1..a0dba9e 100644 --- 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 @@ -20,41 +20,46 @@ package org.onap.ransim.websocket.model; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; 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; + return idGNBDUFunction; } + public void setIdGNBDUFunction(String idGNBDUFunction) { - this.idGNBDUFunction = idGNBDUFunction; + this.idGNBDUFunction = idGNBDUFunction; } + public Attributes getAttributes() { - return attributes; + return attributes; } + public void setAttributes(Attributes attributes) { - this.attributes = attributes; + this.attributes = attributes; } + public List<NRCellDU> getnRCellDU() { - return nRCellDU; + return nRCellDU; } + public void setnRCellDU(List<NRCellDU> nRCellDU) { - this.nRCellDU = nRCellDU; - } - public GNBDUFunction() - { - + 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 0417d81..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,29 +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; + private int measurementInterval; + private List<AdditionalMeasurements> additionalMeasurements; - public int getMeasurementInterval() { - return measurementInterval; - } + public int getMeasurementInterval() { + return measurementInterval; + } - public void setMeasurementInterval(int measurementInterval) { - this.measurementInterval = measurementInterval; - } + public void setMeasurementInterval(int measurementInterval) { + this.measurementInterval = measurementInterval; + } - public List<AdditionalMeasurements> getAdditionalMeasurements() { - return additionalMeasurements; - } + public List<AdditionalMeasurements> getAdditionalMeasurements() { + return additionalMeasurements; + } - public void setAdditionalMeasurements(List<AdditionalMeasurements> additionalMeasurements) { - this.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 295b3bf..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 @@ -21,19 +21,19 @@ 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 = "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_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"; + 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 = "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_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 209c5fd..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 @@ -24,32 +24,32 @@ import java.util.List; public class ModifyNeighbor { - private String pnfName; - private String cellId; - private List<NeighborHo> neighborList; + private String pnfName; + private String cellId; + private List<NeighborHo> neighborList; - public String getPnfName() { - return pnfName; - } + public String getPnfName() { + return pnfName; + } - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } - public String getCellId() { - return cellId; - } + public String getCellId() { + return cellId; + } - public void setCellId(String cellId) { - this.cellId = cellId; - } + public void setCellId(String cellId) { + this.cellId = cellId; + } - public List<NeighborHo> getNeighborList() { - return neighborList; - } + public List<NeighborHo> getNeighborList() { + return neighborList; + } - public void setNeighborList(List<NeighborHo> neighborList) { - this.neighborList = 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 7214ae8..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 @@ -24,84 +24,84 @@ import java.util.List; public class ModifyPci { - private String pnfName; - - private long pciId; - - private String cellId; - - private List<Neighbor> neighborList; - - public long getPciId() { - return pciId; - } - - public void setPciId(long pciId) { - this.pciId = pciId; - } - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - @Override - public String toString() { - return "ModifyPci [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + "neighborList:" - + neighborList + "]"; - } - - public ModifyPci() { - } - - /** - * 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 - */ - public ModifyPci(String pnfName, long pciId, String cellId, List<Neighbor> neighborList) { - super(); - this.pnfName = pnfName; - this.pciId = pciId; - this.cellId = cellId; - this.neighborList = neighborList; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public List<Neighbor> getNeighborList() { - return neighborList; - } - - public void setNeighborList(List<Neighbor> neighborList) { - this.neighborList = neighborList; - } - - /** - * Checks if all the parameters are set correctly . - * - * @return returns true if the parameter are set correctly - */ - public boolean isAllSet() { - if (pnfName == null || pnfName.trim().equals("")) { - return false; - } - if (cellId == null || cellId.trim().equals("")) { - return false; - } - return true; - } + private String pnfName; + + private long pciId; + + private String cellId; + + private List<Neighbor> neighborList; + + public long getPciId() { + return pciId; + } + + public void setPciId(long pciId) { + this.pciId = pciId; + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + @Override + public String toString() { + return "ModifyPci [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + "neighborList:" + + neighborList + "]"; + } + + public ModifyPci() { + } + + /** + * 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 + */ + public ModifyPci(String pnfName, long pciId, String cellId, List<Neighbor> neighborList) { + super(); + this.pnfName = pnfName; + this.pciId = pciId; + this.cellId = cellId; + this.neighborList = neighborList; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public List<Neighbor> getNeighborList() { + return neighborList; + } + + public void setNeighborList(List<Neighbor> neighborList) { + this.neighborList = neighborList; + } + + /** + * Checks if all the parameters are set correctly . + * + * @return returns true if the parameter are set correctly + */ + public boolean isAllSet() { + if (pnfName == null || pnfName.trim().equals("")) { + return false; + } + if (cellId == null || cellId.trim().equals("")) { + return false; + } + return true; + } } 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 index c631c5a..bc6003f 100644 --- 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 @@ -19,34 +19,38 @@ */ 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; + return idNRCellDU; } + public void setIdNRCellDU(String idNRCellDU) { - this.idNRCellDU = idNRCellDU; + this.idNRCellDU = idNRCellDU; } + public Attributes getAttributes() { - return attributes; + return attributes; } + public void setAttributes(Attributes attributes) { - this.attributes = attributes; + this.attributes = attributes; } + public NRCellDU(Attributes attributes) { - super(); - this.attributes = attributes; + super(); + this.attributes = attributes; } - public NRCellDU() - { - + + 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 index f684781..0178fa1 100644 --- 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 @@ -20,49 +20,57 @@ package org.onap.ransim.websocket.model; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; 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() - { - - } + + 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 59d9659..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 @@ -22,68 +22,68 @@ package org.onap.ransim.websocket.model; public class Neighbor { - private String plmnId; - private String nodeId; - private long physicalCellId; - private String serverId; - private String pnfName; - private boolean blacklisted; - - public String getPlmnId() { - return plmnId; - } - - public void setPlmnId(String plmnId) { - this.plmnId = plmnId; - } - - 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 getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public Neighbor() { - // TODO Auto-generated constructor stub - } - - public boolean isBlacklisted() { - return blacklisted; - } - - public void setBlacklisted(boolean blacklisted) { - this.blacklisted = blacklisted; - } - - @Override - public String toString() { - return "Neighbor [nodeId=" + nodeId + ", physicalCellId=" + physicalCellId + ", serverId=" + serverId - + ", pnfName=" + pnfName + "]"; - } + private String plmnId; + private String nodeId; + private long physicalCellId; + private String serverId; + private String pnfName; + private boolean blacklisted; + + public String getPlmnId() { + return plmnId; + } + + public void setPlmnId(String plmnId) { + this.plmnId = plmnId; + } + + 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 getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public Neighbor() { + // TODO Auto-generated constructor stub + } + + public boolean isBlacklisted() { + return blacklisted; + } + + public void setBlacklisted(boolean blacklisted) { + this.blacklisted = blacklisted; + } + + @Override + public String toString() { + return "Neighbor [nodeId=" + nodeId + ", physicalCellId=" + physicalCellId + ", serverId=" + serverId + + ", pnfName=" + pnfName + "]"; + } } 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 4bccb6d..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 @@ -22,32 +22,32 @@ package org.onap.ransim.websocket.model; public class NeighborHo { - private String nodeId; - private long pciId; - private boolean blacklisted; + private String nodeId; + private long pciId; + private boolean blacklisted; - public String getNodeId() { - return nodeId; - } + public String getNodeId() { + return nodeId; + } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } - public long getPciId() { - return pciId; - } + public long getPciId() { + return pciId; + } - public void setPciId(long pciId) { - this.pciId = pciId; - } + public void setPciId(long pciId) { + this.pciId = pciId; + } - public boolean isBlacklisted() { - return blacklisted; - } + public boolean isBlacklisted() { + return blacklisted; + } - public void setBlacklisted(boolean blacklisted) { - this.blacklisted = 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 9bdf27a..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 @@ -24,14 +24,14 @@ import java.util.List; public class PmMessage { - List<EventPm> eventPmList; + List<EventPm> eventPmList; - public void setEventPmList(List<EventPm> data) { - this.eventPmList = data; - } + public void setEventPmList(List<EventPm> data) { + this.eventPmList = data; + } - public List<EventPm> getEventPmList() { - return eventPmList; - } + 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 index e03f9f3..cd72f18 100644 --- 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 @@ -1,47 +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 java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-@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()
- {
-
- }
-
-}
-
+/*- + * ============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 index 2558b91..2e8d78b 100644 --- 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 @@ -1,51 +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() {
-
- }
-
-}
+/* + * ============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 d61e5c3..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 @@ -24,70 +24,70 @@ import java.util.List; public class SetConfigTopology { - private String serverId; - private String uuid; - private String ip; - private String netconfPort; - private List<Topology> topology; - - public 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 - */ - public SetConfigTopology(String serverId, String ip, String netconfPort, List<Topology> topology) { - super(); - this.serverId = serverId; - this.ip = ip; - this.netconfPort = netconfPort; - this.topology = topology; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - 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 List<Topology> getTopology() { - return topology; - } - - public void setTopology(List<Topology> topology) { - this.topology = topology; - } + private String serverId; + private String uuid; + private String ip; + private String netconfPort; + private List<Topology> topology; + + public 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 + */ + public SetConfigTopology(String serverId, String ip, String netconfPort, List<Topology> topology) { + super(); + this.serverId = serverId; + this.ip = ip; + this.netconfPort = netconfPort; + this.topology = topology; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + 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 List<Topology> getTopology() { + return topology; + } + + public void setTopology(List<Topology> topology) { + this.topology = topology; + } } 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 index 13a6b4d..077abcd 100644 --- 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 @@ -1,83 +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() {
-
- }
-
-}
+/*- + * ============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 9869ea4..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 @@ -24,69 +24,69 @@ import java.util.List; public class Topology { - private String pnfName; - - private long pciId; - - private String cellId; - - private List<Neighbor> neighborList; - - public long getPciId() { - return pciId; - } - - public void setPciId(long pciId) { - this.pciId = pciId; - } - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public List<Neighbor> getNeighborList() { - return neighborList; - } - - public void setNeighborList(List<Neighbor> neighborList) { - this.neighborList = neighborList; - } - - @Override - public String toString() { - return "Topology [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + ", neighborList = " - + neighborList + "]"; - } - - /** - * 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 - */ - public Topology(String pnfName, long pciId, String cellId, List<Neighbor> neighborList) { - super(); - this.pnfName = pnfName; - this.pciId = pciId; - this.cellId = cellId; - this.neighborList = neighborList; - } - - public Topology() { - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } + private String pnfName; + + private long pciId; + + private String cellId; + + private List<Neighbor> neighborList; + + public long getPciId() { + return pciId; + } + + public void setPciId(long pciId) { + this.pciId = pciId; + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public List<Neighbor> getNeighborList() { + return neighborList; + } + + public void setNeighborList(List<Neighbor> neighborList) { + this.neighborList = neighborList; + } + + @Override + public String toString() { + return "Topology [PnfName = " + pnfName + ", PciId = " + pciId + ", cellId = " + cellId + ", neighborList = " + + neighborList + "]"; + } + + /** + * 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 + */ + public Topology(String pnfName, long pciId, String cellId, List<Neighbor> neighborList) { + super(); + this.pnfName = pnfName; + this.pciId = pciId; + this.cellId = cellId; + this.neighborList = neighborList; + } + + public Topology() { + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } } 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 e515172..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 @@ -22,60 +22,60 @@ package org.onap.ransim.websocket.model; public class UpdateCell { - private String serverId; - private String ip; - private String netconfPort; - Topology oneCell; + private String serverId; + private String ip; + private String netconfPort; + Topology oneCell; - public UpdateCell() { - } + public UpdateCell() { + } - public String getServerId() { - return serverId; - } + public String getServerId() { + return serverId; + } - public void setServerId(String serverId) { - this.serverId = serverId; - } + public void setServerId(String serverId) { + this.serverId = serverId; + } - public String getIp() { - return ip; - } + public String getIp() { + return ip; + } - public void setIp(String ip) { - this.ip = ip; - } + public void setIp(String ip) { + this.ip = ip; + } - public String getNetconfPort() { - return netconfPort; - } + public String getNetconfPort() { + return netconfPort; + } - public void setNetconfPort(String netconfPort) { - this.netconfPort = netconfPort; - } + public void setNetconfPort(String netconfPort) { + this.netconfPort = netconfPort; + } - public Topology getOneCell() { - return oneCell; - } + public Topology getOneCell() { + return oneCell; + } - public void setOneCell(Topology oneCell) { - this.oneCell = oneCell; - } + public void setOneCell(Topology oneCell) { + this.oneCell = oneCell; + } - /** - * Update cell details based on input. - * - * @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(); - this.serverId = serverId; - this.ip = ip; - this.netconfPort = netconfPort; - this.oneCell = oneCell; - } + /** + * Update cell details based on input. + * + * @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(); + this.serverId = serverId; + this.ip = ip; + this.netconfPort = netconfPort; + this.oneCell = oneCell; + } } 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 c58feeb..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,13 +23,13 @@ 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.services.RansimControllerServices; @@ -41,214 +41,221 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @Controller -@ServerEndpoint(value = "/RansimAgent/{IpPort}", encoders = { DeviceDataEncoder.class }, decoders = { - DeviceDataDecoder.class }) +@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 - */ - @OnOpen - public void onOpen(Session session, @PathParam("IpPort") String ipPort) { - try { - 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 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) { - */ - @OnMessage - 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) { - 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)) { - log.info("Modify pci message received"); - rscServices.handleModifyPciFromSdnr(message.getMessage(), session, ipPort); - } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { - log.info("Modify anr message received"); - 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 - */ - @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()); - 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); - data.setMessage(str); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void sendPmMessage(String str, Session session) { - DeviceData data = new DeviceData(); - data.setType(MessageTypes.RC_TO_HC_PMDATA); - data.setMessage(str); - log.info("data.setMessage: " + data.getMessage()); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - + 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 + */ + @OnOpen + public void onOpen(Session session, @PathParam("IpPort") String ipPort) { + try { + 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 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) { + */ + @OnMessage + 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) { + 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)) { + log.info("Modify pci message received"); + rscServices.handleModifyPciFromSdnr(message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { + log.info("Modify anr message received"); + 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 + */ + @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()); + 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); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendPmMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_PMDATA); + data.setMessage(str); + log.info("data.setMessage: " + data.getMessage()); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + public static void sendIntelligentSlicingPmData(String str, Session session) { - DeviceData data = new DeviceData(); + 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); - data.setMessage(str); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void sendSetConfigTopologyMessage(String str, Session session) { - DeviceData data = new DeviceData(); - data.setType(MessageTypes.RC_TO_HC_SETCONFIGTOPO); - data.setMessage(str); - try { - sendMessage(data, session); - } catch (Exception e) { - 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); - data.setMessage(""); - try { - sendMessage(data, session); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static void sendMessage(DeviceData data, Session session) { - try { - session.getBasicRemote().sendObject(data); - } catch (Exception e) { - log.info("Exception in sendMessage:", e); - } - } + 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); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void sendSetConfigTopologyMessage(String str, Session session) { + DeviceData data = new DeviceData(); + data.setType(MessageTypes.RC_TO_HC_SETCONFIGTOPO); + data.setMessage(str); + try { + sendMessage(data, session); + } catch (Exception e) { + 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); + data.setMessage(""); + try { + sendMessage(data, session); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void sendMessage(DeviceData data, Session session) { + try { + session.getBasicRemote().sendObject(data); + } catch (Exception e) { + log.info("Exception in sendMessage:", e); + } + } } 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 89cfb86..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; @@ -32,10 +34,10 @@ import java.util.Set; import mockit.Mock; import mockit.MockUp; + import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import static org.mockito.Mockito.when; import org.mockito.runners.MockitoJUnitRunner; import org.onap.ransim.rest.api.models.CellDetails; import org.onap.ransim.rest.api.models.CellNeighbor; @@ -60,253 +62,251 @@ import org.springframework.http.ResponseEntity; @RunWith(MockitoJUnitRunner.class) @PropertySource("classpath:ransim.properties") public class TestRansimController { - - @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 { + + @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 { + @Test + public void testFailureStartRanSimulation() throws Exception { RansimController rscontroller = new RansimController(); - ResponseEntity<String> result = rscontroller.startRanSliceSimulation(); + ResponseEntity<String> result = rscontroller.startRanSliceSimulation(); assertEquals(result.getStatusCode(), HttpStatus.INTERNAL_SERVER_ERROR); - } + } + + @Test + public void testStopRanSimulation() throws Exception { - @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 { + @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 { + @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 index dbea6d0..3ffea5b 100644 --- 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 @@ -1,336 +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 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;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@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());
- }
-
-}
+/* + * ============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()); + } + +} |