diff options
author | vvarvate <vv00489503@techmahindra.com> | 2022-09-06 18:34:41 +0530 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2022-10-13 22:01:12 +0000 |
commit | 6e2a9f94f63c57786fd9b6d4ba5f53cb66f7f5e2 (patch) | |
tree | 88ec82e291de14861ddc39e7b7f900a272b3e96f /ransim | |
parent | b5050799014b831a89d09078ce09829458da9339 (diff) |
RAN-Sim Updates for SON Use Case Kohn Release
Enhancement of RAN-Sim Controller to support A1-based action
Issue-ID: INT-2130
Signed-off-by: vvarvate <vv00489503@techmahindra.com>
Change-Id: Ibeeb93a97582ca3712af11e2204a46c6a66dcb81
Diffstat (limited to 'ransim')
18 files changed, 1019 insertions, 1 deletions
diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/netconf/NetconfClient.java index 344dfd7..80e74c8 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 @@ -55,6 +55,7 @@ import org.json.simple.JSONObject; import org.apache.log4j.Logger; import org.onap.ransim.rest.api.models.PLMNInfoModel; +import org.onap.ransim.rest.api.models.GNBCUCPFunction; import org.onap.ransim.rest.web.mapper.NRRelationData; import org.onap.ransim.rest.web.mapper.GNBCUCPModel; import org.onap.ransim.rest.web.mapper.GNBCUUPModel; @@ -65,6 +66,8 @@ import org.onap.ransim.rest.web.mapper.NRCellRelationModel; import org.onap.ransim.rest.web.mapper.NearRTRICModel; import org.onap.ransim.websocket.model.ConfigData; import org.onap.ransim.rest.api.services.RANSliceConfigService; +import org.onap.ransim.websocket.model.LTECell; +import org.onap.ransim.websocket.model.PayloadOutput; import org.springframework.beans.factory.annotation.Autowired; public class NetconfClient { @@ -514,4 +517,106 @@ public class NetconfClient { log.error("Exception occured during edit config {}", e); } } + + + + public Element updateNeighbourListCUCP(PayloadOutput neighbourListinUse, String serverId) { + // TODO Auto-generated method stub + + + try { + log.info("update Neighbourlist data to netconf server"); + Element ranNetworkElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/ran-network"); + Element nearRTRICElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/NearRTRIC"); + Element idNearRTRICElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/idNearRTRIC"); + idNearRTRICElement.setValue(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(neighbourListinUse.getConfigurations().get(0).getData().getFAPService().getIdNRCellCU()); + + 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); + + 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(neighbourListinUse.getConfigurations().get(0).getData().getFAPService().getIdNRCellCU()); + Element gnBIdElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBId"); + gnBIdElement.setValue(32); + Element gNBIdLengthElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/gNBIdLength"); + gNBIdLengthElement.setValue(98763); + attributesElement.addChild(gNBCUNameElement); + attributesElement.addChild(gnBIdElement); + attributesElement.addChild(gNBIdLengthElement); + attributesElement.addChild(sapElement); + + + 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"); + + String localcellID=neighbourListinUse.getConfigurations().get(0).getData().getFAPService().getCellConfig().getLte().getRan().getCommon().getCellIdentity(); + idNRCellCUElement.setValue(localcellID); + 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(localcellID); + nRCellattributesElement.addChild(cellLocalIdElement); + nRCellattributesElement.addChild(sapElement); + nRCellCUElement.addChild(idNRCellCUElement); + nRCellCUElement.addChild(nRCellattributesElement); + List<LTECell> LTECellList=neighbourListinUse.getConfigurations().get(0).getData().getFAPService().getCellConfig().getLte().getRan().getNeighborListInUse().getLTECell(); + for (LTECell nRCellRelationModel : LTECellList) { + Element nRCellRelationElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/NRCellRelation"); + Element idNRCellRelationElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/idNRCellRelation"); + idNRCellRelationElement.setValue(nRCellRelationModel.getIdNRCellRelation()); + Element nRCellRelationattributesElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/attributes"); + Element nRTCIElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/nRTCI"); + nRTCIElement.setValue(nRCellRelationModel.getIdNRCellRelation()); + Element isHOAllowedElement = + Element.create("org:onap:ccsdk:features:sdnr:northbound:ran-network", "/isHOAllowed"); + isHOAllowedElement.setValue(nRCellRelationModel.getIsHOAllowed()); + nRCellRelationattributesElement.addChild(nRTCIElement); + nRCellRelationattributesElement.addChild(isHOAllowedElement); + nRCellRelationattributesElement.addChild(sapElement); + nRCellRelationElement.addChild(idNRCellRelationElement); + nRCellRelationElement.addChild(nRCellRelationattributesElement); + nRCellCUElement.addChild(nRCellRelationElement); + } + + + gNBCUCPFunctionElement.addChild(idGNBCUCPFunctionElement); + gNBCUCPFunctionElement.addChild(nRCellCUElement); + + nearRTRICElement.addChild(idNearRTRICElement); + nearRTRICElement.addChild(gNBCUCPFunctionElement); + + ranNetworkElement.addChild(nearRTRICElement); + ranNetworkElement.markMerge(); + return ranNetworkElement; + + } catch (JNCException e) { + log.error("Exception occured during NodeSet creation {}", e); + return null; + } + } } 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 94ac9c8..027c97e 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 @@ -104,6 +104,11 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; + @Service public class RansimControllerServices { @@ -1806,6 +1811,123 @@ public class RansimControllerServices { } } + public synchronized void addWebSocketSessionsForRanApp(String ipPort, Session session) { + // TODO Auto-generated method stub + if (webSocketSessions.containsKey(ipPort)) { + log.info("addWebSocketSessions: Client session " + session.getId() + " for " + ipPort + + " already exist. Removing old session."); + webSocketSessions.remove(ipPort); + } + + log.info("addWebSocketSessions: Adding Client session " + session.getId() + " for " + ipPort); + webSocketSessions.put(ipPort, session); + } + + + + public ResponsetoRanapp sendPayloadtoHC(String message,String ipPort, Session session) { + // TODO Auto-generated method stub + addWebSocketSessionsForRanApp(ipPort, session); + ResponsetoRanapp response=new ResponsetoRanapp(); + try { + + PayloadOutput neighbourListinUse=new ObjectMapper().readValue(message, PayloadOutput.class); + log.info("neighbourListinUse payload: "+ neighbourListinUse); + NetconfServers server=findserverIdfromPayload(neighbourListinUse); + if( server != null) { + NetconfClient netconfClient = new NetconfClient("ransim", "admin", "admin", server.getServerId(), + server.getIp(), Integer.parseInt(server.getNetconfPort())); + log.info("Initializing Netconf client session for "+ server.getIp() +":"+server.getNetconfPort()); + Integer nearrtric=nearrtricfindNearrtricIdfromserverId(server.getServerId()); + netconfClient.editConfig( + netconfClient.updateNeighbourListCUCP(neighbourListinUse, nearrtric.toString())); + response.setResponse_code(200); + response.setError_info("Neighbour Cell Relation changed Successfully"); + return response; + }else { + log.info("HC device not found for the respective config change"); + response.setResponse_code(400); + response.setError_info("HC device not found"); + return response; + } + } catch (JsonParseException e) { + // TODO Auto-generated catch block + e.getLocalizedMessage(); + e.printStackTrace(); + response.setResponse_code(500); + if(e.getMessage() == null) { + response.setError_info("Causing JsonParse Exception"); + }else + response.setError_info(e.getMessage()); + return response; + } catch (JsonMappingException e) { + // TODO Auto-generated catch block + e.getLocalizedMessage(); + e.printStackTrace(); + response.setResponse_code(500); + if(e.getMessage() == null) { + response.setError_info("Causing JsonMapping Exception"); + }else + response.setError_info(e.getMessage()); + return response; + } catch (Exception e) { + // TODO Auto-generated catch block + e.getLocalizedMessage(); + e.printStackTrace(); + response.setResponse_code(500); + if(e.getMessage() == null) { + response.setError_info("Exception Occured while connecting Netconf server"); + }else + response.setError_info(e.getMessage()); + return response; + } + + } + + private Integer nearrtricfindNearrtricIdfromserverId(String serverId) { + // TODO Auto-generated method stub + Integer gnbcucpmodel = null,gnbcuupmodel = null,gnbdumodel = null; + gnbcucpmodel=ransimRepo.getNeartricfromCUCPmodel(serverId); + if(gnbcucpmodel == null) { + gnbcuupmodel=ransimRepo.getNeartricfromCUUPmodel(serverId); + if(gnbcuupmodel == null) { + gnbdumodel=ransimRepo.getNeartricfromDUmodel(serverId); + if(gnbdumodel == null) { + return null; + }else + return gnbdumodel; + }else + return gnbcuupmodel; + }else + return gnbcucpmodel; + + + } + + private NetconfServers findserverIdfromPayload(PayloadOutput readValue) { + // TODO Auto-generated method stub + String serverId=readValue.getConfigurations().get(0).getData().getFAPService().getIdNRCellCU(); + if(serverIdIpPortMapping.keySet().contains(serverId)) { + try { + log.info("Retrieve Netconf server from database using serverId: "+serverId); + NetconfServers server = ransimRepo.getNetconfServer(serverId); + if (server != null) { + log.info("Retrieved Netconf server"+ server +"from database using serverId: "+serverId); + return server; + }else { + log.info("No Netconf server found for serverId"+ serverId); + return null; + } + } catch (Exception e1) { + log.error("Exception mapServerIdToNodes :", e1); + } + } + log.info("serverIdIpPortMapping does not contain serverId"+ serverId + "in it"); + + return null; + } + + } 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 8a6713b..6c607ea 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 @@ -33,8 +33,14 @@ import org.onap.ransim.rest.api.models.NRCellCU; import org.onap.ransim.rest.api.models.NRCellDU; import org.onap.ransim.rest.api.models.NRCellRelation; import org.onap.ransim.rest.api.models.OperationLog; +import org.onap.ransim.rest.api.models.GNBCUCPFunction; +import org.onap.ransim.rest.api.models.GNBCUUPFunction; +import org.onap.ransim.rest.api.models.GNBDUFunction; import org.onap.ransim.rest.api.repository.CellDetailsRepo; import org.onap.ransim.rest.api.repository.CellNeighborRepo; +import org.onap.ransim.rest.api.repository.GNBCUCPRepository; +import org.onap.ransim.rest.api.repository.GNBCUUPRepository; +import org.onap.ransim.rest.api.repository.GNBDURepository; import org.onap.ransim.rest.api.repository.NRCellCURepository; import org.onap.ransim.rest.api.repository.NRCellDURepository; import org.onap.ransim.rest.api.repository.NRCellRelationRepository; @@ -72,6 +78,15 @@ public class RansimRepositoryService { @Autowired OperationLogRepo operationLogRepo; + + @Autowired + GNBCUCPRepository gnbcucpfuncRepo; + + @Autowired + GNBCUUPRepository gnbcuupfuncRepo; + + @Autowired + GNBDURepository gnbdufuncRepo; /** * Method to retrieve cell details @@ -383,4 +398,42 @@ public class RansimRepositoryService { public void mergeOperationLog(OperationLog opLog) { operationLogRepo.save(opLog); } + + public Integer getNeartricfromCUCPmodel(String serverId) { + // TODO Auto-generated method stub + Optional<GNBCUCPFunction> cucp = gnbcucpfuncRepo.findById(serverId); + GNBCUCPFunction cucpdetails = null; + if (cucp.isPresent()) { + cucpdetails = cucp.get(); + return cucpdetails.getNearRTRIC().getNearRTRICId(); + }else + return null; + + } + + public Integer getNeartricfromCUUPmodel(String serverId) { + // TODO Auto-generated method stub + Optional<GNBCUUPFunction> cuup = gnbcuupfuncRepo.findById(Integer.getInteger(serverId)); + GNBCUUPFunction cuupdetails = null; + if (cuup.isPresent()) { + cuupdetails = cuup.get(); + return cuupdetails.getNearRTRIC().getNearRTRICId(); + }else + return null; + } + + public Integer getNeartricfromDUmodel(String serverId) { + // TODO Auto-generated method stub + + + Optional<GNBDUFunction> du = gnbdufuncRepo.findById(Integer.getInteger(serverId)); + GNBDUFunction dudetails = null; + if (du.isPresent()) { + dudetails = du.get(); + return dudetails.getNearRTRIC().getNearRTRICId(); + }else + return null; + } + + } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CellConfig.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CellConfig.java new file mode 100644 index 0000000..4b7b021 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CellConfig.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"LTE" +}) +@Generated("jsonschema2pojo") +public class CellConfig { + +@JsonProperty("LTE") +private LTE lte; + + +@JsonProperty("LTE") +public LTE getLte() { +return lte; +} + +@JsonProperty("LTE") +public void setLte(LTE lte) { +this.lte = lte; +} + + +@Override +public String toString() { + return "CellConfig [lte=" + lte + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Common.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Common.java new file mode 100644 index 0000000..c4514fa --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Common.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"CellIdentity" +}) +@Generated("jsonschema2pojo") +public class Common { + +@JsonProperty("CellIdentity") +private String cellIdentity; + + +@JsonProperty("CellIdentity") +public String getCellIdentity() { +return cellIdentity; +} + +@JsonProperty("CellIdentity") +public void setCellIdentity(String cellIdentity) { +this.cellIdentity = cellIdentity; +} + + + +@Override +public String toString() { + return "Common [cellIdentity=" + cellIdentity + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Configuration.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Configuration.java new file mode 100644 index 0000000..d5d0753 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Configuration.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"data" +}) +@Generated("jsonschema2pojo") +public class Configuration { + +@JsonProperty("data") +private Data data; + +@JsonProperty("data") +public Data getData() { +return data; +} + +@JsonProperty("data") +public void setData(Data data) { +this.data = data; +} + +@Override +public String toString() { + return "Configuration [data=" + data + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Data.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Data.java new file mode 100644 index 0000000..88dd5f0 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Data.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"FAPService" +}) +@Generated("jsonschema2pojo") +public class Data { + + +@JsonProperty("ric_id") +private String ricId; + +@JsonProperty("FAPService") +private FAPService fAPService; + +@JsonProperty("ric_id") +public String getRicId() { + return ricId; +} + +@JsonProperty("ric_id") +public void setRicId(String ricId) { + this.ricId = ricId; +} + +@JsonProperty("FAPService") +public FAPService getFAPService() { +return fAPService; +} + +@JsonProperty("FAPService") +public void setFAPService(FAPService fAPService) { +this.fAPService = fAPService; +} + + + +@Override +public String toString() { + return "Data [ricId=" + ricId + ", fAPService=" + fAPService + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FAPService.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FAPService.java new file mode 100644 index 0000000..89516b8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FAPService.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"alias", +"CellConfig" +}) +@Generated("jsonschema2pojo") +public class FAPService { + +@JsonProperty("idNRCellCU") +private String idNRCellCU; +@JsonProperty("CellConfig") +private CellConfig cellConfig; + + + +@JsonProperty("idNRCellCU") +public String getIdNRCellCU() { + return idNRCellCU; +} + +@JsonProperty("idNRCellCU") +public void setIdNRCellCU(String idNRCellCU) { + this.idNRCellCU = idNRCellCU; +} + +@JsonProperty("CellConfig") +public CellConfig getCellConfig() { +return cellConfig; +} + +@JsonProperty("CellConfig") +public void setCellConfig(CellConfig cellConfig) { +this.cellConfig = cellConfig; +} + + +@Override +public String toString() { + return "FAPService [alias=" + idNRCellCU + ", cellConfig=" + cellConfig + + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/LTE.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/LTE.java new file mode 100644 index 0000000..bfec2f1 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/LTE.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"RAN" +}) +@Generated("jsonschema2pojo") +public class LTE { + +@JsonProperty("RAN") +private RAN ran; + + +@JsonProperty("RAN") +public RAN getRan() { +return ran; +} + +@JsonProperty("RAN") +public void setRan(RAN ran) { +this.ran = ran; +} + + + +@Override +public String toString() { + return "LTE [ran=" + ran + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/LTECell.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/LTECell.java new file mode 100644 index 0000000..1b0faba --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/LTECell.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"idGNBCUCPFunction", +"PLMNID", +"idNRCellRelation", +"nRTCI", +"isHOAllowed" +}) +@Generated("jsonschema2pojo") +public class LTECell { + +@JsonProperty("idGNBCUCPFunction") +private String idGNBCUCPFunction; +@JsonProperty("PLMNID") +private String plmnid; +@JsonProperty("idNRCellRelation") +private String idNRCellRelation; +@JsonProperty("nRTCI") +private Integer nRTCI; +@JsonProperty("isHOAllowed") +private String isHOAllowed; +public String getIdGNBCUCPFunction() { + return idGNBCUCPFunction; +} +public void setIdGNBCUCPFunction(String idGNBCUCPFunction) { + this.idGNBCUCPFunction = idGNBCUCPFunction; +} +public String getPlmnid() { + return plmnid; +} +public void setPlmnid(String plmnid) { + this.plmnid = plmnid; +} +public String getIdNRCellRelation() { + return idNRCellRelation; +} +public void setIdNRCellRelation(String idNRCellRelation) { + this.idNRCellRelation = idNRCellRelation; +} +public Integer getnRTCI() { + return nRTCI; +} +public void setnRTCI(Integer nRTCI) { + this.nRTCI = nRTCI; +} +public String getIsHOAllowed() { + return isHOAllowed; +} +public void setIsHOAllowed(String isHOAllowed) { + this.isHOAllowed = isHOAllowed; +} +@Override +public String toString() { + return "LTECell [idGNBCUCPFunction=" + idGNBCUCPFunction + ", plmnid=" + plmnid + ", idNRCellRelation=" + + idNRCellRelation + ", nRTCI=" + nRTCI + ", isHOAllowed=" + isHOAllowed + "]"; +} + + + + +}
\ No newline at end of file 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 28fd704..cf219a7 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 @@ -36,4 +36,6 @@ public class MessageTypes { 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 APP_TO_RC_CONNECTION = "INITIAL_CONFIRMATION"; + public final static String APP_TO_RC_KAFKA_MSG = "KAFKA_MSG"; } diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborListInUse.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborListInUse.java new file mode 100644 index 0000000..79ddadf --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborListInUse.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"LTECell", +"LTECellNumberOfEntries" +}) +@Generated("jsonschema2pojo") +public class NeighborListInUse { + +@JsonProperty("LTECell") +private List<LTECell> lTECell = null; +@JsonProperty("LTECellNumberOfEntries") +private String lTECellNumberOfEntries; + + +@JsonProperty("LTECell") +public List<LTECell> getLTECell() { +return lTECell; +} + +@JsonProperty("LTECell") +public void setLTECell(List<LTECell> lTECell) { +this.lTECell = lTECell; +} + +@JsonProperty("LTECellNumberOfEntries") +public String getLTECellNumberOfEntries() { +return lTECellNumberOfEntries; +} + +@JsonProperty("LTECellNumberOfEntries") +public void setLTECellNumberOfEntries(String lTECellNumberOfEntries) { +this.lTECellNumberOfEntries = lTECellNumberOfEntries; +} + + + +@Override +public String toString() { + return "NeighborListInUse [lTECell=" + lTECell + ", lTECellNumberOfEntries=" + lTECellNumberOfEntries + + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PayloadOutput.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PayloadOutput.java new file mode 100644 index 0000000..e480643 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PayloadOutput.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"Configurations" +}) +@Generated("jsonschema2pojo") +public class PayloadOutput { + +@JsonProperty("Configurations") +private List<Configuration> configurations = null; + + +@JsonProperty("Configurations") +public List<Configuration> getConfigurations() { +return configurations; +} + +@JsonProperty("Configurations") +public void setConfigurations(List<Configuration> configurations) { +this.configurations = configurations; +} + +@Override +public String toString() { + return "PayloadOutput [configurations=" + configurations + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RAN.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RAN.java new file mode 100644 index 0000000..0fee7e4 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/RAN.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ +package org.onap.ransim.websocket.model; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ +"Common", +"NeighborListInUse" +}) +@Generated("jsonschema2pojo") +public class RAN { + +@JsonProperty("Common") +private Common common; + +@JsonProperty("Common") +public Common getCommon() { +return common; +} + +@JsonProperty("Common") +public void setCommon(Common common) { +this.common = common; +} +@JsonProperty("NeighborListInUse") +private NeighborListInUse neighborListInUse; + + + + +@JsonProperty("NeighborListInUse") +public NeighborListInUse getNeighborListInUse() { +return neighborListInUse; +} + +@JsonProperty("NeighborListInUse") +public void setNeighborListInUse(NeighborListInUse neighborListInUse) { +this.neighborListInUse = neighborListInUse; +} + + + +@Override +public String toString() { + return "RAN [common=" + common + ", neighborListInUse=" + neighborListInUse + + "]"; +} + +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ResponsetoRanapp.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ResponsetoRanapp.java new file mode 100644 index 0000000..ed2cadd --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ResponsetoRanapp.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ + +package org.onap.ransim.websocket.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ResponsetoRanapp { + + @Override + public String toString() { + return "{ \"response-code\":" + response_code + ", \"error-info\":" + error_info + "}"; + } + + @JsonProperty("response-code") + private int response_code; + + + @JsonProperty("error-info") + private String error_info; + + @JsonProperty("response-code") + public int getResponse_code() { + return response_code; + } + + @JsonProperty("response-code") + public void setResponse_code(int response_code) { + this.response_code = response_code; + } + + @JsonProperty("error-info") + public String getError_info() { + return error_info; + } + + @JsonProperty("error-info") + public void setError_info(String error_info) { + this.error_info = error_info; + } +} 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 f8928e9..68ccb28 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 @@ -37,6 +37,7 @@ import org.onap.ransim.websocket.model.DeviceData; import org.onap.ransim.websocket.model.DeviceDataDecoder; import org.onap.ransim.websocket.model.DeviceDataEncoder; import org.onap.ransim.websocket.model.MessageTypes; +import org.onap.ransim.websocket.model.ResponsetoRanapp; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -142,7 +143,18 @@ public class RansimWebSocketServer { } else if (message.getType().equals(MessageTypes.HC_TO_RC_SLICE_PROFILE_DEL)) { log.info("Delete SliceProfile message received"); rscServices.handleSliceProfileDeleteFromSdnr(message.getMessage(), session, ipPort); - } + } else if (message.getType().equals(MessageTypes.APP_TO_RC_CONNECTION)){ + log.info(message.getMessage()); + } else if (message.getType().equals(MessageTypes.APP_TO_RC_KAFKA_MSG)) { + log.info(message.getMessage()); + ResponsetoRanapp ws_msgtoranapp=rscServices.sendPayloadtoHC(message.getMessage(),ipPort,session); + DeviceData devicedata=new DeviceData(); + devicedata.setMessage(ws_msgtoranapp.toString()); + devicedata.setType(MessageTypes.APP_TO_RC_KAFKA_MSG); + log.info(String.format("Sending Output Payload to "+ipPort+" Server")); + sendMessage(devicedata,session); + + } } } } catch (Exception e) { diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties index 02a81ec..671ea0e 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/application.properties @@ -6,3 +6,5 @@ spring.datasource.url=jdbc:mariadb://mariadb:3306/ransim_db hibernate.dialect=org.hibernate.dialect.MariaDBDialect spring.config.location=/tmp/ransim-install/config/ spring.config.name=ransim +logging.level.ROOT=INFO +logging.level.org.springframework=INFO diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/log4j.properties b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/log4j.properties index 6042e35..80d1283 100644 --- a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/log4j.properties +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/resources/log4j.properties @@ -48,3 +48,17 @@ log4j.appender.AUDIT_LOG.DatePattern='.'yyyy-MM-dd log4j.appender.AUDIT_LOG.threshold=INFO log4j.appender.AUDIT_LOG.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.AUDIT_LOG.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss}{GMT+0}+00:00|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{server}|%X{clientIpAddress}|%X{className}|%X{timer}|%m%n + + +### +# Hibernate +### +# basic log level for all messages +#log4j.logger.org.hibernate=error +# SQL statements and parameters +#log4j.logger.org.hibernate.SQL=debug +#log4j.logger.org.hibernate.type.descriptor.sql=trace +# Statistics +#log4j.logger.org.hibernate.stat=debug +# 2nd Level Cache +#log4j.logger.org.hibernate.cache=debug |