diff options
Diffstat (limited to 'ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket')
21 files changed, 1495 insertions, 0 deletions
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 new file mode 100644 index 0000000..650bfa8 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/AdditionalMeasurements.java @@ -0,0 +1,50 @@ +/*- + * ============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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AdditionalMeasurements { + + private String name; + private Map<String, String> hashMap = new HashMap<String, String>(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Map<String, String> getHashMap() { + return 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/CommonEventHeaderFm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java new file mode 100644 index 0000000..aa75009 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderFm.java @@ -0,0 +1,86 @@ +/*- + * ============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 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; + } + +} 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 new file mode 100644 index 0000000..9f87529 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/CommonEventHeaderPm.java @@ -0,0 +1,62 @@ +/*- + * ============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 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; + } + +} 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 new file mode 100644 index 0000000..5954408 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceData.java @@ -0,0 +1,47 @@ +/*- + * ============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.io.Serializable; + +public class DeviceData implements Serializable { + + private static final long serialVersionUID = 4388248209444904611L; + + private String type; + private String message; + + public void setType(String type) { + this.type = type; + } + + public String getType() { + return type; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } +}
\ No newline at end of file diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java new file mode 100644 index 0000000..caddc59 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataDecoder.java @@ -0,0 +1,57 @@ +/*- + * ============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 javax.websocket.DecodeException; +import javax.websocket.Decoder; +import javax.websocket.EndpointConfig; + +public class DeviceDataDecoder implements Decoder.Text<DeviceData> { + + // public class DeviceDataDecoder implements Decoder.Text<DeviceData> + @Override + public void destroy() { + } + + @Override + public void init(EndpointConfig arg0) { + } + + @Override + public DeviceData decode(String msgInfo) throws DecodeException { + DeviceData data = new DeviceData(); + 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) { + // TODO Auto-generated method stub + return true; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java new file mode 100644 index 0000000..6c29929 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/DeviceDataEncoder.java @@ -0,0 +1,47 @@ +/*- + * ============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 javax.websocket.EncodeException; +import javax.websocket.Encoder; +import javax.websocket.EndpointConfig; + +public class DeviceDataEncoder implements Encoder.Text<DeviceData> { + + @Override + public void destroy() { + // TODO Auto-generated method stub + + } + + @Override + public void init(EndpointConfig arg0) { + // TODO Auto-generated method stub + + } + + @Override + public String encode(DeviceData msg) throws EncodeException { + String result = msg.getType() + ":" + msg.getMessage(); + return result; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java new file mode 100644 index 0000000..ec340f5 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventFm.java @@ -0,0 +1,55 @@ +/*- + * ============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 EventFm { + + private CommonEventHeaderFm commonEventHeader; + private FaultFields faultFields; + + public EventFm(CommonEventHeaderFm commonEventHeader, FaultFields faultFields) { + super(); + this.commonEventHeader = commonEventHeader; + this.faultFields = faultFields; + } + + public EventFm() { + super(); + // TODO Auto-generated constructor stub + } + + public CommonEventHeaderFm getCommonEventHeader() { + return commonEventHeader; + } + + public void setCommonEventHeader(CommonEventHeaderFm commonEventHeader) { + this.commonEventHeader = commonEventHeader; + } + + public FaultFields getFaultFields() { + return faultFields; + } + + public void setFaultFields(FaultFields faultFields) { + this.faultFields = faultFields; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java new file mode 100644 index 0000000..f6dbb63 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/EventPm.java @@ -0,0 +1,44 @@ +/*- + * ============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 EventPm { + + private CommonEventHeaderPm commonEventHeader; + private Measurement measurement; + + public CommonEventHeaderPm getCommonEventHeader() { + return commonEventHeader; + } + + public void setCommonEventHeader(CommonEventHeaderPm commonEventHeader) { + this.commonEventHeader = commonEventHeader; + } + + public Measurement getMeasurement() { + return measurement; + } + + public void setMeasurement(Measurement measurement) { + this.measurement = measurement; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java new file mode 100644 index 0000000..ebf31f7 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FaultFields.java @@ -0,0 +1,88 @@ +/*- + * ============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.Map; + +public class FaultFields { + + private String alarmCondition; + private String eventSourceType; + private String specificProblem; + private String eventSeverity; + private Map<String, String> alarmAdditionalInformation; + + public FaultFields() { + super(); + // TODO Auto-generated constructor stub + } + + public FaultFields(String alarmCondition, String eventSourceType, String specificProblem, + String eventSeverity, Map<String, String> alarmAdditionalInformation) { + 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 new file mode 100644 index 0000000..c11ab64 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/FmMessage.java @@ -0,0 +1,37 @@ +/*- + * ============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; + +public class FmMessage { + + List<EventFm> fmEventList; + + public void setFmEventList(List<EventFm> data) { + this.fmEventList = data; + } + + public List<EventFm> getFmEventList() { + return fmEventList; + } + +} 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 new file mode 100644 index 0000000..8f9de10 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Measurement.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * Ran Simulator Controller + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.ransim.websocket.model; + +import java.util.List; + +public class Measurement { + + private int measurementInterval; + private List<AdditionalMeasurements> additionalMeasurements; + + public int getMeasurementInterval() { + return measurementInterval; + } + + public void setMeasurementInterval(int measurementInterval) { + this.measurementInterval = measurementInterval; + } + + public List<AdditionalMeasurements> getAdditionalMeasurements() { + return additionalMeasurements; + } + + public void setAdditionalMeasurements( + List<AdditionalMeasurements> additionalMeasurements) { + 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 new file mode 100644 index 0000000..da4bf92 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/MessageTypes.java @@ -0,0 +1,33 @@ +/*- + * ============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 MessageTypes { + public final static String RC_TO_HC_FMDATA = "FmData"; + public final static String RC_TO_HC_PMDATA = "PmData"; + public final static String RC_TO_HC_SETCONFIGTOPO = "SetConfigTopology"; + public final static String RC_TO_HC_UPDCELL = "UpdateCell"; + public final static String RC_TO_HC_PING = "ping"; + + public final static String HC_TO_RC_MODPCI = "ModifyPci"; + public final static String HC_TO_RC_MODANR = "ModifyAnr"; + +} 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 new file mode 100644 index 0000000..30ec5d0 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyNeighbor.java @@ -0,0 +1,55 @@ +/*- + * ============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; + +public class ModifyNeighbor { + + private String pnfName; + private String cellId; + private List<NeighborHo> neighborList; + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public String getCellId() { + return cellId; + } + + public void setCellId(String cellId) { + this.cellId = cellId; + } + + public List<NeighborHo> getNeighborList() { + return neighborList; + } + + public void setNeighborList(List<NeighborHo> neighborList) { + this.neighborList = neighborList; + } + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java new file mode 100644 index 0000000..6a52624 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/ModifyPci.java @@ -0,0 +1,112 @@ +/*- + * ============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; + +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() { + // TODO Auto-generated constructor stub + } + + /** + * Modify Pci value from sdnr. + * + * @param pnfName + * server id name + * @param pciId + * pci number + * @param cellId + * node id for the cell + * @param neighborList + * neighbor list for the cell + */ + 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/Neighbor.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java new file mode 100644 index 0000000..65c6940 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Neighbor.java @@ -0,0 +1,88 @@ +/*- + * ============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 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 + "]"; + } +} 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 new file mode 100644 index 0000000..5b7f41a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/NeighborHo.java @@ -0,0 +1,51 @@ +/*- + * ============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 NeighborHo { + + private String nodeId; + private long pciId; + private boolean blacklisted; + + public String getNodeId() { + return nodeId; + } + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public long getPciId() { + return pciId; + } + public void setPciId(long pciId) { + this.pciId = pciId; + } + public boolean isBlacklisted() { + return blacklisted; + } + public void setBlacklisted(boolean blacklisted) { + this.blacklisted = blacklisted; + } + + + +} diff --git a/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java new file mode 100644 index 0000000..3fb63b7 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/PmMessage.java @@ -0,0 +1,37 @@ +/*- + * ============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; + +public class PmMessage { + + List<EventPm> eventPmList; + + public void setEventPmList(List<EventPm> data) { + this.eventPmList = data; + } + + public List<EventPm> getEventPmList() { + return eventPmList; + } + +} 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 new file mode 100644 index 0000000..9b22ebd --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/SetConfigTopology.java @@ -0,0 +1,97 @@ +/*- + * ============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; + +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; + } + +} 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 new file mode 100644 index 0000000..b99f64a --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/Topology.java @@ -0,0 +1,96 @@ +/*- + * ============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; + +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; + } + +} 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 new file mode 100644 index 0000000..5794fb1 --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/model/UpdateCell.java @@ -0,0 +1,85 @@ +/*- + * ============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 UpdateCell { + + private String serverId; + private String ip; + private String netconfPort; + Topology oneCell; + + public UpdateCell() { + } + + 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 Topology getOneCell() { + return 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; + } + +} 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 new file mode 100644 index 0000000..db94bfd --- /dev/null +++ b/ransim/ransimctrlr/RANSIM-CTRLR/src/main/java/org/onap/ransim/websocket/server/RansimWebSocketServer.java @@ -0,0 +1,222 @@ +/*- + * ============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.server; + +import java.io.IOException; + +import javax.websocket.CloseReason; +import javax.websocket.OnClose; +import javax.websocket.OnMessage; +import javax.websocket.OnOpen; +import javax.websocket.Session; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import javax.websocket.EncodeException; + +import org.apache.log4j.Logger; +import org.onap.ransim.rest.api.controller.RansimController; +import org.onap.ransim.websocket.model.DeviceData; +import org.onap.ransim.websocket.model.DeviceDataDecoder; +import org.onap.ransim.websocket.model.DeviceDataEncoder; +import org.onap.ransim.websocket.model.MessageTypes; + +@ServerEndpoint(value = "/RansimAgent/{IpPort}", encoders = { DeviceDataEncoder.class }, decoders = { DeviceDataDecoder.class }) +public class RansimWebSocketServer { + + static Logger log = Logger.getLogger(RansimWebSocketServer.class.getName()); + + /** + * 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) { + log.info("WSS Ransim client(" + ipPort + ") opened a connection with id " + session.getId()); + try { + String serverId = RansimController.getRansimController().addWebSocketSessions(ipPort, + session); + if (serverId != null) { + log.info("New websocket session added for " + serverId); + RansimController.getRansimController().sendInitialConfigForNewAgent(ipPort, + serverId); + } else { + log.info("RansimWebSocketServer: No assigned ServerId found - No intial configuration sent to New Agent " + + ipPort); + } + } catch (Exception e) { + log.info("Exception in onOpen:", e); + } + } + + /* + @OnMessage + public void onMessage(String messageStr, Session session, @PathParam("IpPort") String ipPort) { + log.info("WSS Str Message received from client(" + ipPort + ") with id " + session.getId()); + try { + if (messageStr != null) { + DeviceData message = new DeviceDataDecoder().decode(messageStr); + if (message.getMessage() == null || message.getMessage().trim().equals("")) { + log.debug("Periodic ping message.... ignore"); + return; + } else { + + if (message.getType().equals(MessageTypes.HC_TO_RC_MODPCI)) { + RansimController.getRansimController().handleModifyPciFromSdnr( + message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { + RansimController.getRansimController().handleModifyNeighborFromSdnr( + message.getMessage(), session, ipPort); + } + } + } + } catch (Exception e) { + log.info("Exception in onMessage:", 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"); + RansimController.getRansimController().handleModifyPciFromSdnr( + message.getMessage(), session, ipPort); + } else if (message.getType().equals(MessageTypes.HC_TO_RC_MODANR)) { + log.info("Modify anr message received"); + RansimController.getRansimController().handleModifyNeighborFromSdnr( + message.getMessage(), session, ipPort); + } + } + } + } 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()); + RansimController.getRansimController().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 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 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); + } + } +} |