added javadocs and comments
diff --git a/src/main/java/org.onosproject.xran/XranStore.java b/src/main/java/org.onosproject.xran/XranStore.java
index 00984b9..63a1a02 100644
--- a/src/main/java/org.onosproject.xran/XranStore.java
+++ b/src/main/java/org.onosproject.xran/XranStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.store.Store;
import org.onosproject.xran.codecs.api.ECGI;
-import org.onosproject.xran.codecs.api.MMEUES1APID;
import org.onosproject.xran.controller.XranController;
import org.onosproject.xran.entities.RnibCell;
import org.onosproject.xran.entities.RnibLink;
@@ -37,65 +36,215 @@
// LINKS STORE
+ /**
+ * Get all active links.
+ *
+ * @return list of links
+ */
List<RnibLink> getLinks();
- List<RnibLink> getLinksByECGI(ECGI ecgi);
+ /**
+ * Get all links for that CELL based on ECGI.
+ *
+ * @param ecgi CELL ECGI
+ * @return list of links
+ */
+ List<RnibLink> getlinksbyecgi(ECGI ecgi);
- List<RnibLink> getLinksByCellId(String eciHex);
+ /**
+ * Get all links for that CELL based on ECI.
+ *
+ * @param eciHex HEX string of ECI
+ * @return list of links
+ */
+ List<RnibLink> getlinksbycellid(String eciHex);
- List<RnibLink> getLinksByUeId(long ueId);
+ /**
+ * Get all links for the UE based on UE ID.
+ *
+ * @param ueId UE ID
+ * @return list of links
+ */
+ List<RnibLink> getlinksbyueid(long ueId);
- RnibLink getLinkBetweenCellIdUeId(String cellId, long ueId);
+ /**
+ * Get a link between a CELL and UE.
+ *
+ * @param cellId HEX string ECI
+ * @param ueId UE id
+ * @return link
+ */
+ RnibLink getlinkbetweencellidueid(String cellId, long ueId);
+ /**
+ * Get a link between a CELL's ECGI and UE's id.
+ *
+ * @param ecgi CELL ECGI
+ * @param ueId UE id
+ * @return link
+ */
RnibLink getLink(ECGI ecgi, Long ueId);
- void modifyLinkRrmConf(RnibLink link, JsonNode rrmConf);
+ /**
+ * Modify specified link's RRM Configuration.
+ *
+ * @param link LINK entity
+ * @param rrmConf json node of RRM Configuration
+ */
+ void modifylinkrrmconf(RnibLink link, JsonNode rrmConf);
+ /**
+ * Put new link to store.
+ *
+ * @param link LINK entity
+ */
void storeLink(RnibLink link);
+ /**
+ * Remove link from store.
+ *
+ * @param link LINK entity
+ * @return true if remove succeeded
+ */
boolean removeLink(LinkId link);
// NODES
+ /**
+ * Get all CELLs and UEs.
+ *
+ * @return list of UEs and CELLs
+ */
List<Object> getNodes();
- List<Object> getCellNodes();
+ /**
+ * Get all CELLs.
+ *
+ * @return list of CELLs
+ */
+ List<Object> getcellnodes();
- List<Object> getUeNodes();
+ /**
+ * Get all UEs.
+ *
+ * @return list of UEs
+ */
+ List<Object> getuenodes();
- Object getByNodeId(String nodeId);
+ /**
+ * Get node by node id.
+ *
+ * @param nodeId HEX string ECI or UE id
+ * @return CELL or UE
+ */
+ Object getbynodeid(String nodeId);
// CELL
+ /**
+ * Get cell based on HEX string ECI.
+ *
+ * @param eci HEX string ECI
+ * @return CELL if found
+ */
RnibCell getCell(String eci);
+ /**
+ * Get cell based on ECGI.
+ *
+ * @param cellId CELL ECGI
+ * @return CELL if found
+ */
RnibCell getCell(ECGI cellId);
- void modifyCellRrmConf(RnibCell cell, JsonNode rrmConf) throws Exception;
+ /**
+ * Modify CELL's RRM Configuration.
+ *
+ * @param cell CELL entity
+ * @param rrmConf json node of RRM Configuration
+ * @throws Exception exception
+ */
+ void modifycellrrmconf(RnibCell cell, JsonNode rrmConf) throws Exception;
+ /**
+ * Put new CELL to the store.
+ *
+ * @param cell CELL entity
+ */
void storeCell(RnibCell cell);
+ /**
+ * Remove CELL from the store.
+ *
+ * @param ecgi CELL's ECGI
+ * @return ture if remove succeeded
+ */
boolean removeCell(ECGI ecgi);
// SLICE
+ /**
+ * Get SLICE based on SLICE id.
+ *
+ * @param sliceId SLICE id
+ * @return SLICE
+ */
RnibSlice getSlice(long sliceId);
+ /**
+ * Put new SLICE to the store.
+ *
+ * @param attributes json node of SLICE attributes
+ * @return true if put succeeded
+ */
boolean createSlice(ObjectNode attributes);
+ /**
+ * Remove SLICE based on SLICE id.
+ *
+ * @param sliceId SLICE id
+ * @return true if remove succeeded
+ */
boolean removeCell(long sliceId);
// CONTROLLER
+ /**
+ * Get the xran controller instance.
+ *
+ * @return xran controller
+ */
XranController getController();
+ /**
+ * Set the xran controller instance.
+ *
+ * @param controller xran controller
+ */
void setController(XranController controller);
// UE
+ /**
+ * Get UE based on UE id.
+ *
+ * @param euId UE id
+ * @return UE entity
+ */
RnibUe getUe(long euId);
+ /**
+ * Put new UE to store.
+ *
+ * @param ue UE entity
+ */
void storeUe(RnibUe ue);
+ /**
+ * Remove UE from store.
+ *
+ * @param ueId UE id
+ * @return true if remove succeeded
+ */
boolean removeUe(long ueId);
}
diff --git a/src/main/java/org.onosproject.xran/annotations/Patch.java b/src/main/java/org.onosproject.xran/annotations/Patch.java
index 8058902..bc882c5 100644
--- a/src/main/java/org.onosproject.xran/annotations/Patch.java
+++ b/src/main/java/org.onosproject.xran/annotations/Patch.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
import java.lang.annotation.Target;
/**
- * Created by dimitris on 7/21/17.
+ * PATCH interface for swagger.
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/src/main/java/org.onosproject.xran/annotations/package-info.java b/src/main/java/org.onosproject.xran/annotations/package-info.java
index e035cf2..0f85a05 100644
--- a/src/main/java/org.onosproject.xran/annotations/package-info.java
+++ b/src/main/java/org.onosproject.xran/annotations/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java b/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
index a02833d..7a44283 100644
--- a/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
+++ b/src/main/java/org.onosproject.xran/codecs/api/PCIARFCN.java
@@ -16,168 +16,172 @@
public class PCIARFCN implements Serializable {
- private static final long serialVersionUID = 1L;
+ public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
+ private static final long serialVersionUID = 1L;
+ @JsonIgnore
+ public byte[] code = null;
+ private PhysCellId pci = null;
+ private ARFCNValue earfcnDl = null;
- public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
+ public PCIARFCN() {
+ }
- @JsonIgnore
- public byte[] code = null;
- private PhysCellId pci = null;
- private ARFCNValue earfcnDl = null;
-
- public PCIARFCN() {
- }
+ public PCIARFCN(byte[] code) {
+ this.code = code;
+ }
- public PCIARFCN(byte[] code) {
- this.code = code;
- }
+ public static PCIARFCN valueOf(PhysCellId pci, ARFCNValue arfcnValue) {
+ PCIARFCN pciarfcn = new PCIARFCN();
+ pciarfcn.setEarfcnDl(arfcnValue);
+ pciarfcn.setPci(pci);
+ return pciarfcn;
+ }
- public void setPci(PhysCellId pci) {
- this.pci = pci;
- }
+ public PhysCellId getPci() {
+ return pci;
+ }
- public PhysCellId getPci() {
- return pci;
- }
+ public void setPci(PhysCellId pci) {
+ this.pci = pci;
+ }
- public void setEarfcnDl(ARFCNValue earfcnDl) {
- this.earfcnDl = earfcnDl;
- }
+ public ARFCNValue getEarfcnDl() {
+ return earfcnDl;
+ }
- public ARFCNValue getEarfcnDl() {
- return earfcnDl;
- }
+ public void setEarfcnDl(ARFCNValue earfcnDl) {
+ this.earfcnDl = earfcnDl;
+ }
- public int encode(BerByteArrayOutputStream os) throws IOException {
- return encode(os, true);
- }
+ public int encode(BerByteArrayOutputStream os) throws IOException {
+ return encode(os, true);
+ }
- public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
+ public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
- if (code != null) {
- for (int i = code.length - 1; i >= 0; i--) {
- os.write(code[i]);
- }
- if (withTag) {
- return tag.encode(os) + code.length;
- }
- return code.length;
- }
+ if (code != null) {
+ for (int i = code.length - 1; i >= 0; i--) {
+ os.write(code[i]);
+ }
+ if (withTag) {
+ return tag.encode(os) + code.length;
+ }
+ return code.length;
+ }
- int codeLength = 0;
- codeLength += earfcnDl.encode(os, false);
- // write tag: CONTEXT_CLASS, PRIMITIVE, 1
- os.write(0x81);
- codeLength += 1;
-
- codeLength += pci.encode(os, false);
- // write tag: CONTEXT_CLASS, PRIMITIVE, 0
- os.write(0x80);
- codeLength += 1;
-
- codeLength += BerLength.encodeLength(os, codeLength);
+ int codeLength = 0;
+ codeLength += earfcnDl.encode(os, false);
+ // write tag: CONTEXT_CLASS, PRIMITIVE, 1
+ os.write(0x81);
+ codeLength += 1;
- if (withTag) {
- codeLength += tag.encode(os);
- }
+ codeLength += pci.encode(os, false);
+ // write tag: CONTEXT_CLASS, PRIMITIVE, 0
+ os.write(0x80);
+ codeLength += 1;
- return codeLength;
+ codeLength += BerLength.encodeLength(os, codeLength);
- }
+ if (withTag) {
+ codeLength += tag.encode(os);
+ }
- public int decode(InputStream is) throws IOException {
- return decode(is, true);
- }
+ return codeLength;
- public int decode(InputStream is, boolean withTag) throws IOException {
- int codeLength = 0;
- int subCodeLength = 0;
- BerTag berTag = new BerTag();
+ }
- if (withTag) {
- codeLength += tag.decodeAndCheck(is);
- }
+ public int decode(InputStream is) throws IOException {
+ return decode(is, true);
+ }
- BerLength length = new BerLength();
- codeLength += length.decode(is);
+ public int decode(InputStream is, boolean withTag) throws IOException {
+ int codeLength = 0;
+ int subCodeLength = 0;
+ BerTag berTag = new BerTag();
- int totalLength = length.val;
- codeLength += totalLength;
+ if (withTag) {
+ codeLength += tag.decodeAndCheck(is);
+ }
- subCodeLength += berTag.decode(is);
- if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
- pci = new PhysCellId();
- subCodeLength += pci.decode(is, false);
- subCodeLength += berTag.decode(is);
- }
- else {
- throw new IOException("Tag does not match the mandatory sequence element tag.");
- }
-
- if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
- earfcnDl = new ARFCNValue();
- subCodeLength += earfcnDl.decode(is, false);
- if (subCodeLength == totalLength) {
- return codeLength;
- }
- }
- throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
+ BerLength length = new BerLength();
+ codeLength += length.decode(is);
-
- }
+ int totalLength = length.val;
+ codeLength += totalLength;
- public void encodeAndSave(int encodingSizeGuess) throws IOException {
- BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
- encode(os, false);
- code = os.getArray();
- }
+ subCodeLength += berTag.decode(is);
+ if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
+ pci = new PhysCellId();
+ subCodeLength += pci.decode(is, false);
+ subCodeLength += berTag.decode(is);
+ } else {
+ throw new IOException("Tag does not match the mandatory sequence element tag.");
+ }
- public String toString() {
- StringBuilder sb = new StringBuilder();
- appendAsString(sb, 0);
- return sb.toString();
- }
+ if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
+ earfcnDl = new ARFCNValue();
+ subCodeLength += earfcnDl.decode(is, false);
+ if (subCodeLength == totalLength) {
+ return codeLength;
+ }
+ }
+ throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
- public void appendAsString(StringBuilder sb, int indentLevel) {
- sb.append("{");
- sb.append("\n");
- for (int i = 0; i < indentLevel + 1; i++) {
- sb.append("\t");
- }
- if (pci != null) {
- sb.append("pci: ").append(pci);
- }
-
- sb.append(",\n");
- for (int i = 0; i < indentLevel + 1; i++) {
- sb.append("\t");
- }
- if (earfcnDl != null) {
- sb.append("earfcnDl: ").append(earfcnDl);
- }
-
- sb.append("\n");
- for (int i = 0; i < indentLevel; i++) {
- sb.append("\t");
- }
- sb.append("}");
- }
+ }
- @Override
- public boolean equals(Object o) {
- if (o instanceof PCIARFCN) {
- return pci.equals(((PCIARFCN) o).getPci()) && earfcnDl.equals(((PCIARFCN) o).getEarfcnDl());
- }
+ public void encodeAndSave(int encodingSizeGuess) throws IOException {
+ BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
+ encode(os, false);
+ code = os.getArray();
+ }
- return super.equals(o);
- }
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ appendAsString(sb, 0);
+ return sb.toString();
+ }
- @Override
- public int hashCode() {
- int result = pci.hashCode();
- result = 31 * result + earfcnDl.hashCode();
- return result;
- }
+ public void appendAsString(StringBuilder sb, int indentLevel) {
+
+ sb.append("{");
+ sb.append("\n");
+ for (int i = 0; i < indentLevel + 1; i++) {
+ sb.append("\t");
+ }
+ if (pci != null) {
+ sb.append("pci: ").append(pci);
+ }
+
+ sb.append(",\n");
+ for (int i = 0; i < indentLevel + 1; i++) {
+ sb.append("\t");
+ }
+ if (earfcnDl != null) {
+ sb.append("earfcnDl: ").append(earfcnDl);
+ }
+
+ sb.append("\n");
+ for (int i = 0; i < indentLevel; i++) {
+ sb.append("\t");
+ }
+ sb.append("}");
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof PCIARFCN) {
+ return pci.equals(((PCIARFCN) o).getPci()) && earfcnDl.equals(((PCIARFCN) o).getEarfcnDl());
+ }
+
+ return super.equals(o);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = pci.hashCode();
+ result = 31 * result + earfcnDl.hashCode();
+ return result;
+ }
}
diff --git a/src/main/java/org.onosproject.xran/codecs/api/package-info.java b/src/main/java/org.onosproject.xran/codecs/api/package-info.java
index e3949c9..ace3595 100644
--- a/src/main/java/org.onosproject.xran/codecs/api/package-info.java
+++ b/src/main/java/org.onosproject.xran/codecs/api/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java b/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
index 570aae0..f258255 100644
--- a/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
+++ b/src/main/java/org.onosproject.xran/codecs/pdu/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/controller/Controller.java b/src/main/java/org.onosproject.xran/controller/Controller.java
index 2191f5b..946a1bd 100644
--- a/src/main/java/org.onosproject.xran/controller/Controller.java
+++ b/src/main/java/org.onosproject.xran/controller/Controller.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,9 @@
private int port = 8007;
private boolean isRunning = false;
+ /**
+ * Run SCTP server.
+ */
public void run() {
final Controller ctrl = this;
try {
@@ -62,6 +65,11 @@
}
}
+ /**
+ * Create bootstrap for server.
+ *
+ * @return server bootstrap
+ */
private ServerBootstrap createServerBootStrap() {
bossGroup = new NioEventLoopGroup(1);
workerGroup = new NioEventLoopGroup();
@@ -73,6 +81,14 @@
return b;
}
+ /**
+ * Initialize controller and start SCTP server.
+ *
+ * @param deviceAgent device agent
+ * @param hostAgent host agent
+ * @param packetAgent packet agent
+ * @param port port of server
+ */
public void start(XranDeviceAgent deviceAgent, XranHostAgent hostAgent, XranPacketProcessor packetAgent, int port) {
if (isRunning && this.port != port) {
stop();
@@ -91,7 +107,9 @@
}
}
-
+ /**
+ * Stop SCTP server.
+ */
public void stop() {
if (isRunning) {
channel.channel().close();
diff --git a/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java b/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java
index 764f55c..d429602 100644
--- a/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java
+++ b/src/main/java/org.onosproject.xran/controller/XranChannelHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,9 +36,8 @@
import java.net.URISyntaxException;
/**
- * Created by dimitris on 7/20/17.
+ * Xran channel handler.
*/
-
@Sharable
public class XranChannelHandler extends ChannelInboundHandlerAdapter {
@@ -51,6 +50,13 @@
this.controller = controller;
}
+ /**
+ * Given PDU construct an SCTP message.
+ *
+ * @param pdu PDU packet
+ * @return SCTP message
+ * @throws IOException IO exception
+ */
public static SctpMessage getSctpMessage(XrancPdu pdu) throws IOException {
BerByteArrayOutputStream os = new BerByteArrayOutputStream(4096);
@@ -90,13 +96,13 @@
byte[] bytes = new byte[byteBuf.readableBytes()];
byteBuf.readBytes(bytes);
- XrancPdu recv_pdu = new XrancPdu();
+ XrancPdu recvPdu = new XrancPdu();
InputStream inputStream = new ByteArrayInputStream(bytes);
- recv_pdu.decode(inputStream);
+ recvPdu.decode(inputStream);
- controller.packetAgent.handlePacket(recv_pdu, ctx);
+ controller.packetAgent.handlePacket(recvPdu, ctx);
}
@Override
diff --git a/src/main/java/org.onosproject.xran/controller/XranController.java b/src/main/java/org.onosproject.xran/controller/XranController.java
index 0ab91ef..b08c714 100644
--- a/src/main/java/org.onosproject.xran/controller/XranController.java
+++ b/src/main/java/org.onosproject.xran/controller/XranController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,23 +28,73 @@
*/
public interface XranController {
+ /**
+ * Send a HandOff request from one link to another.
+ *
+ * @param newLink target LINK entity
+ * @param oldLink source LINK entity
+ * @return blocking queue for RESPONSE
+ * @throws InterruptedException interrupted exception
+ */
SynchronousQueue<String> sendHORequest(RnibLink newLink, RnibLink oldLink) throws InterruptedException;
+ /**
+ * Add a device listener for CELL connections.
+ *
+ * @param listener listener
+ */
void addListener(XranDeviceListener listener);
+ /**
+ * Add a host listener for UE connections.
+ *
+ * @param listener listener
+ */
void addListener(XranHostListener listener);
+ /**
+ * Remove a CELL device listener.
+ *
+ * @param listener listener
+ */
void removeListener(XranDeviceListener listener);
+ /**
+ * Remove a UE host listener.
+ *
+ * @param listener listener
+ */
void removeListener(XranHostListener listener);
- SynchronousQueue<String> sendModifiedRRMConf(RRMConfig rrmConfig, boolean xICIC);
+ /**
+ * Send modified RRM configuration or xICICConfing.
+ *
+ * @param rrmConfig configuration fields to send
+ * @param xicic if true sends xicic else it sends RRM
+ * @return blocking queue for RESPONSE
+ */
+ SynchronousQueue<String> sendmodifiedrrmconf(RRMConfig rrmConfig, boolean xicic);
+ /**
+ * Send scell add packet for specified LINK.
+ *
+ * @param link LINK entity
+ * @return blocking queue for RESPONSE
+ */
SynchronousQueue<String> sendScellAdd(RnibLink link);
+ /**
+ * Send scell delete for specified LINK.
+ *
+ * @param link LINK entity
+ * @return true if sent correctly
+ */
boolean sendScellDelete(RnibLink link);
- int getNorthbound_timeout();
-
- void setNorthbound_timeout(int northbound_timeout);
+ /**
+ * Get northbound timeout.
+ *
+ * @return interval in milliseconds
+ */
+ int getNorthboundTimeout();
}
diff --git a/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java b/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
index 99e79a7..8040cea 100644
--- a/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
+++ b/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,21 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.sctp.SctpMessage;
import org.apache.commons.lang.exception.ExceptionUtils;
-import org.apache.felix.scr.annotations.*;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.packet.IpAddress;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
-import org.onosproject.net.config.*;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.net.config.basics.SubjectFactories;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
@@ -32,15 +43,59 @@
import org.onosproject.net.host.HostListener;
import org.onosproject.net.host.HostService;
import org.onosproject.xran.XranStore;
-import org.onosproject.xran.codecs.api.*;
+import org.onosproject.xran.codecs.api.CRNTI;
+import org.onosproject.xran.codecs.api.ECGI;
+import org.onosproject.xran.codecs.api.ERABID;
+import org.onosproject.xran.codecs.api.ERABParams;
+import org.onosproject.xran.codecs.api.ERABParamsItem;
+import org.onosproject.xran.codecs.api.PCIARFCN;
+import org.onosproject.xran.codecs.api.PropScell;
+import org.onosproject.xran.codecs.api.RSRPRange;
+import org.onosproject.xran.codecs.api.RSRQRange;
+import org.onosproject.xran.codecs.api.RXSigReport;
+import org.onosproject.xran.codecs.api.RadioRepPerServCell;
+import org.onosproject.xran.codecs.api.SchedMeasRepPerServCell;
+import org.onosproject.xran.codecs.api.TrafficSplitPercentage;
import org.onosproject.xran.codecs.ber.types.BerInteger;
-import org.onosproject.xran.codecs.pdu.*;
+import org.onosproject.xran.codecs.pdu.BearerAdmissionRequest;
+import org.onosproject.xran.codecs.pdu.BearerAdmissionResponse;
+import org.onosproject.xran.codecs.pdu.BearerAdmissionStatus;
+import org.onosproject.xran.codecs.pdu.BearerReleaseInd;
+import org.onosproject.xran.codecs.pdu.CellConfigReport;
+import org.onosproject.xran.codecs.pdu.CellConfigRequest;
+import org.onosproject.xran.codecs.pdu.HOComplete;
+import org.onosproject.xran.codecs.pdu.HOFailure;
+import org.onosproject.xran.codecs.pdu.HORequest;
+import org.onosproject.xran.codecs.pdu.L2MeasConfig;
+import org.onosproject.xran.codecs.pdu.PDCPMeasReportPerUe;
+import org.onosproject.xran.codecs.pdu.RRMConfig;
+import org.onosproject.xran.codecs.pdu.RRMConfigStatus;
+import org.onosproject.xran.codecs.pdu.RXSigMeasConfig;
+import org.onosproject.xran.codecs.pdu.RXSigMeasReport;
+import org.onosproject.xran.codecs.pdu.RadioMeasReportPerCell;
+import org.onosproject.xran.codecs.pdu.RadioMeasReportPerUE;
+import org.onosproject.xran.codecs.pdu.ScellAdd;
+import org.onosproject.xran.codecs.pdu.ScellAddStatus;
+import org.onosproject.xran.codecs.pdu.ScellDelete;
+import org.onosproject.xran.codecs.pdu.SchedMeasReportPerCell;
+import org.onosproject.xran.codecs.pdu.SchedMeasReportPerUE;
+import org.onosproject.xran.codecs.pdu.TrafficSplitConfig;
+import org.onosproject.xran.codecs.pdu.UEAdmissionRequest;
+import org.onosproject.xran.codecs.pdu.UEAdmissionResponse;
+import org.onosproject.xran.codecs.pdu.UEAdmissionStatus;
+import org.onosproject.xran.codecs.pdu.UECapabilityEnquiry;
+import org.onosproject.xran.codecs.pdu.UECapabilityInfo;
+import org.onosproject.xran.codecs.pdu.UEContextUpdate;
+import org.onosproject.xran.codecs.pdu.UEReconfigInd;
+import org.onosproject.xran.codecs.pdu.UEReleaseInd;
+import org.onosproject.xran.codecs.pdu.XICICConfig;
+import org.onosproject.xran.codecs.pdu.XrancPdu;
import org.onosproject.xran.entities.RnibCell;
import org.onosproject.xran.entities.RnibLink;
import org.onosproject.xran.entities.RnibUe;
+import org.onosproject.xran.identifiers.ContextUpdateHandler;
import org.onosproject.xran.identifiers.EcgiCrntiPair;
import org.onosproject.xran.identifiers.LinkId;
-import org.onosproject.xran.identifiers.contextUpdateHandler;
import org.onosproject.xran.impl.XranConfig;
import org.onosproject.xran.providers.XranDeviceListener;
import org.onosproject.xran.providers.XranHostListener;
@@ -51,8 +106,18 @@
import org.slf4j.LoggerFactory;
import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.SynchronousQueue;
import java.util.stream.Collectors;
import static org.onosproject.net.DeviceId.deviceId;
@@ -79,7 +144,7 @@
private final Controller controller = new Controller();
private XranConfig xranConfig;
private ApplicationId appId;
- private int northbound_timeout;
+ private int northboundTimeout;
/* Services */
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private DeviceService deviceService;
@@ -106,11 +171,11 @@
private UeMap ueMap;
private LinkMap linkMap;
/* MAPS */
- private ConcurrentMap<String, ECGI> legitCells = new ConcurrentHashMap<>();
+ private ConcurrentMap<IpAddress, ECGI> legitCells = new ConcurrentHashMap<>();
private ConcurrentMap<ECGI, SynchronousQueue<String>> hoMap = new ConcurrentHashMap<>();
- private ConcurrentMap<ECGI, SynchronousQueue<String>> RRMCellMap = new ConcurrentHashMap<>();
+ private ConcurrentMap<ECGI, SynchronousQueue<String>> rrmcellMap = new ConcurrentHashMap<>();
private ConcurrentMap<CRNTI, SynchronousQueue<String>> scellAddMap = new ConcurrentHashMap<>();
- private ConcurrentMap<EcgiCrntiPair, contextUpdateHandler> contextUpdateMap = new ConcurrentHashMap<>();
+ private ConcurrentMap<EcgiCrntiPair, ContextUpdateHandler> contextUpdateMap = new ConcurrentHashMap<>();
/* QUEUE */
private BlockingQueue<Long> ueIdQueue = new LinkedBlockingQueue<>();
/* AGENTS */
@@ -120,8 +185,8 @@
/* LISTENERS */
private Set<XranDeviceListener> xranDeviceListeners = new CopyOnWriteArraySet<>();
private Set<XranHostListener> xranHostListeners = new CopyOnWriteArraySet<>();
- private InternalDeviceListener device_listener = new InternalDeviceListener();
- private InternalHostListener host_listener = new InternalHostListener();
+ private InternalDeviceListener deviceListener = new InternalDeviceListener();
+ private InternalHostListener hostListener = new InternalHostListener();
@Activate
public void activate() {
@@ -129,8 +194,8 @@
configService.addListener(configListener);
registry.registerConfigFactory(xranConfigFactory);
- deviceService.addListener(device_listener);
- hostService.addListener(host_listener);
+ deviceService.addListener(deviceListener);
+ hostService.addListener(hostListener);
cellMap = new CellMap(xranStore);
ueMap = new UeMap(xranStore);
@@ -145,8 +210,8 @@
public void deactivate() {
controller.stop();
- deviceService.removeListener(device_listener);
- hostService.removeListener(host_listener);
+ deviceService.removeListener(deviceListener);
+ hostService.removeListener(hostListener);
legitCells.clear();
@@ -157,29 +222,30 @@
}
@Override
- public SynchronousQueue<String> sendHORequest(RnibLink link_t, RnibLink link_s) throws InterruptedException {
- ECGI ecgi_t = link_t.getLinkId().getEcgi(),
- ecgi_s = link_s.getLinkId().getEcgi();
+ public SynchronousQueue<String> sendHORequest(RnibLink linkT, RnibLink linkS) throws InterruptedException {
+ ECGI ecgiT = linkT.getLinkId().getEcgi(),
+ ecgiS = linkS.getLinkId().getEcgi();
- CRNTI crnti = linkMap.getCrnti(link_t.getLinkId().getUeId());
- ChannelHandlerContext ctx_t = cellMap.getCtx(ecgi_t),
- ctx_s = cellMap.getCtx(ecgi_s);
-
+ CRNTI crnti = linkMap.getCrnti(linkT.getLinkId().getUeId());
+ ChannelHandlerContext ctxT = cellMap.getCtx(ecgiT),
+ ctxS = cellMap.getCtx(ecgiS);
SynchronousQueue<String> queue = new SynchronousQueue<>();
try {
- XrancPdu xrancPdu = HORequest.constructPacket(crnti, ecgi_s, ecgi_t);
+ XrancPdu xrancPdu = HORequest.constructPacket(crnti, ecgiS, ecgiT);
- hoMap.put(ecgi_s, queue);
+ // temporary map that has ECGI source of a handoff to a queue waiting for REST response.
+ hoMap.put(ecgiS, queue);
- ctx_t.writeAndFlush(getSctpMessage(xrancPdu));
- ctx_s.writeAndFlush(getSctpMessage(xrancPdu));
+ ctxT.writeAndFlush(getSctpMessage(xrancPdu));
+ ctxS.writeAndFlush(getSctpMessage(xrancPdu));
+
+ // FIXME: only works for one HO at a time.
+ ueIdQueue.put(linkT.getLinkId().getUeId());
} catch (IOException e) {
e.printStackTrace();
}
- ueIdQueue.put(link_t.getLinkId().getUeId());
-
return queue;
}
@@ -204,23 +270,18 @@
}
@Override
- public int getNorthbound_timeout() {
- return northbound_timeout;
+ public int getNorthboundTimeout() {
+ return northboundTimeout;
}
@Override
- public void setNorthbound_timeout(int northbound_timeout) {
- this.northbound_timeout = northbound_timeout;
- }
-
- @Override
- public SynchronousQueue<String> sendModifiedRRMConf(RRMConfig rrmConfig, boolean xICIC) {
+ public SynchronousQueue<String> sendmodifiedrrmconf(RRMConfig rrmConfig, boolean xicic) {
ECGI ecgi = rrmConfig.getEcgi();
ChannelHandlerContext ctx = cellMap.getCtx(ecgi);
try {
XrancPdu pdu;
- if (xICIC) {
+ if (xicic) {
CellConfigReport cellConfigReport = cellMap.get(ecgi).getConf();
if (cellConfigReport != null) {
pdu = XICICConfig.constructPacket(rrmConfig, cellConfigReport);
@@ -230,7 +291,7 @@
pdu = RRMConfig.constructPacket(rrmConfig);
ctx.writeAndFlush(getSctpMessage(pdu));
SynchronousQueue<String> queue = new SynchronousQueue<>();
- RRMCellMap.put(ecgi, queue);
+ rrmcellMap.put(ecgi, queue);
return queue;
}
} catch (IOException e) {
@@ -304,6 +365,11 @@
return false;
}
+ /**
+ * Timer to delete UE after being IDLE.
+ *
+ * @param ue UE entity
+ */
private void restartTimer(RnibUe ue) {
Timer timer = new Timer();
ue.setTimer(timer);
@@ -320,6 +386,11 @@
}, xranConfig.getIdleUeRemoval());
}
+ /**
+ * Timer to delete LINK after not receiving measurements.
+ *
+ * @param link LINK entity
+ */
private void restartTimer(RnibLink link) {
Timer timer = new Timer();
link.setTimer(timer);
@@ -328,12 +399,49 @@
public void run() {
LinkId linkId = link.getLinkId();
xranStore.removeLink(linkId);
- log.info("Link is removed after not receiving Meas Reports for {} ms", xranConfig.getNoMeasLinkRemoval());
+ log.info("Link is removed after not receiving Meas Reports for {} ms",
+ xranConfig.getNoMeasLinkRemoval());
}
}, xranConfig.getNoMeasLinkRemoval());
}
+ /**
+ * Request measurement configuration field of specified UE.
+ *
+ * @param primary primary CELL
+ * @param ue UE entity
+ */
+ private void populateMeasConfig(RnibCell primary, RnibUe ue) {
+ try {
+ ChannelHandlerContext ctx = cellMap.getCtx(primary.getEcgi());
+ RXSigMeasConfig.MeasCells measCells = new RXSigMeasConfig.MeasCells();
+ xranStore.getcellnodes().forEach(cell -> {
+ CellConfigReport cellReport = ((RnibCell) cell).getConf();
+ if (cellReport != null) {
+ PCIARFCN pciarfcn = new PCIARFCN();
+ pciarfcn.setPci(cellReport.getPci());
+ pciarfcn.setEarfcnDl(cellReport.getEarfcnDl());
+ measCells.setPCIARFCN(pciarfcn);
+ }
+ });
+ XrancPdu xrancPdu = RXSigMeasConfig.constructPacket(
+ primary.getEcgi(),
+ ue.getCrnti(),
+ measCells,
+ xranConfig.getRxSignalInterval()
+ );
+ ue.setMeasConfig(xrancPdu.getBody().getRXSigMeasConfig());
+ ctx.writeAndFlush(getSctpMessage(xrancPdu));
+ } catch (IOException e) {
+ log.warn(ExceptionUtils.getFullStackTrace(e));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Internal device listener.
+ */
class InternalDeviceListener implements DeviceListener {
@Override
@@ -361,14 +469,15 @@
e.printStackTrace();
}
} else {
- List<Object> ueNodes = xranStore.getUeNodes();
+ List<Object> ueNodes = xranStore.getuenodes();
ueNodes.forEach(object -> {
RnibUe ue = (RnibUe) object;
try {
- ECGI primary_ecgi = linkMap.getPrimaryCell(ue).getEcgi();
- ChannelHandlerContext ctx = cellMap.getCtx(primary_ecgi);
- RXSigMeasConfig.MeasCells measCells = new RXSigMeasConfig.MeasCells();
- xranStore.getCellNodes().forEach(cell -> {
+ ECGI primaryEcgi = linkMap.getPrimaryCell(ue).getEcgi();
+ ChannelHandlerContext ctx = cellMap.getCtx(primaryEcgi);
+ RXSigMeasConfig.MeasCells measCells =
+ new RXSigMeasConfig.MeasCells();
+ xranStore.getcellnodes().forEach(cell -> {
CellConfigReport cellReport = ((RnibCell) cell).getConf();
if (cellReport != null) {
PCIARFCN pciarfcn = new PCIARFCN();
@@ -378,7 +487,7 @@
}
});
XrancPdu xrancPdu = RXSigMeasConfig.constructPacket(
- primary_ecgi,
+ primaryEcgi,
ue.getCrnti(),
measCells,
xranConfig.getRxSignalInterval()
@@ -393,7 +502,8 @@
try {
ChannelHandlerContext ctx = cellMap.getCtx(ecgi);
- XrancPdu xrancPdu = L2MeasConfig.constructPacket(ecgi, xranConfig.getL2MeasInterval());
+ XrancPdu xrancPdu = L2MeasConfig
+ .constructPacket(ecgi, xranConfig.getL2MeasInterval());
cell.setMeasConfig(xrancPdu.getBody().getL2MeasConfig());
SctpMessage sctpMessage = getSctpMessage(xrancPdu);
ctx.writeAndFlush(sctpMessage);
@@ -423,6 +533,9 @@
}
}
+ /**
+ * Internal host listener.
+ */
class InternalHostListener implements HostListener {
@Override
@@ -433,8 +546,8 @@
case HOST_MOVED: {
RnibUe ue = ueMap.get(hostIdtoUEId(event.subject().id()));
if (ue != null) {
- ECGI ecgi_primary = linkMap.getPrimaryCell(ue).getEcgi();
- RnibCell primary = cellMap.get(ecgi_primary);
+ ECGI ecgiPrimary = linkMap.getPrimaryCell(ue).getEcgi();
+ RnibCell primary = cellMap.get(ecgiPrimary);
ue.setMeasConfig(null);
if (primary != null) {
Timer timer = new Timer();
@@ -463,30 +576,7 @@
xranConfig.getConfigRequestInterval() * 1000
);
if (ue.getMeasConfig() == null) {
- try {
- ChannelHandlerContext ctx = cellMap.getCtx(primary.getEcgi());
- RXSigMeasConfig.MeasCells measCells = new RXSigMeasConfig.MeasCells();
- xranStore.getCellNodes().forEach(cell -> {
- CellConfigReport cellReport = ((RnibCell) cell).getConf();
- if (cellReport != null) {
- PCIARFCN pciarfcn = new PCIARFCN();
- pciarfcn.setPci(cellReport.getPci());
- pciarfcn.setEarfcnDl(cellReport.getEarfcnDl());
- measCells.setPCIARFCN(pciarfcn);
- }
- });
- XrancPdu xrancPdu = RXSigMeasConfig.constructPacket(
- primary.getEcgi(),
- ue.getCrnti(),
- measCells,
- xranConfig.getRxSignalInterval()
- );
- ue.setMeasConfig(xrancPdu.getBody().getRXSigMeasConfig());
- ctx.writeAndFlush(getSctpMessage(xrancPdu));
- } catch (IOException e) {
- log.warn(ExceptionUtils.getFullStackTrace(e));
- e.printStackTrace();
- }
+ populateMeasConfig(primary, ue);
}
}
}
@@ -499,13 +589,16 @@
}
}
+ /**
+ * Internal xran device agent.
+ */
public class InternalXranDeviceAgent implements XranDeviceAgent {
private final Logger log = LoggerFactory.getLogger(InternalXranDeviceAgent.class);
@Override
public boolean addConnectedCell(String host, ChannelHandlerContext ctx) {
- ECGI ecgi = legitCells.get(host);
+ ECGI ecgi = legitCells.get(IpAddress.valueOf(host));
if (ecgi == null) {
log.error("Device is not a legit source; ignoring...");
@@ -531,10 +624,10 @@
@Override
public boolean removeConnectedCell(String host) {
- ECGI ecgi = legitCells.get(host);
- List<RnibLink> linksByECGI = xranStore.getLinksByECGI(ecgi);
+ ECGI ecgi = legitCells.get(IpAddress.valueOf(host));
+ List<RnibLink> linksbyecgi = xranStore.getlinksbyecgi(ecgi);
- linksByECGI.forEach(rnibLink -> xranStore.removeLink(rnibLink.getLinkId()));
+ linksbyecgi.forEach(rnibLink -> xranStore.removeLink(rnibLink.getLinkId()));
if (cellMap.remove(ecgi)) {
for (XranDeviceListener l : xranDeviceListeners) {
@@ -546,6 +639,9 @@
}
}
+ /**
+ * Internal xran host agent.
+ */
public class InternalXranHostAgent implements XranHostAgent {
@Override
@@ -556,10 +652,11 @@
Set<ECGI> ecgiSet = Sets.newConcurrentHashSet();
- ecgiSet.add(xranStore.getLinksByUeId(ue.getId())
+ xranStore.getlinksbyueid(ue.getId())
.stream()
.filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
- .findFirst().get().getLinkId().getEcgi());
+ .findFirst()
+ .ifPresent(l -> ecgiSet.add(l.getLinkId().getEcgi()));
for (XranHostListener l : xranHostListeners) {
l.hostAdded(ue, ecgiSet);
@@ -581,7 +678,7 @@
@Override
public boolean removeConnectedHost(RnibUe ue) {
- List<RnibLink> links = xranStore.getLinksByUeId(ue.getId());
+ List<RnibLink> links = xranStore.getlinksbyueid(ue.getId());
links.forEach(rnibLink -> xranStore.removeLink(rnibLink.getLinkId()));
if (ueMap.remove(ue.getId())) {
for (XranHostListener l : xranHostListeners) {
@@ -595,465 +692,656 @@
public class InternalXranPacketAgent implements XranPacketProcessor {
@Override
- public void handlePacket(XrancPdu recv_pdu, ChannelHandlerContext ctx) throws IOException, InterruptedException {
- XrancPdu send_pdu;
+ public void handlePacket(XrancPdu recvPdu, ChannelHandlerContext ctx)
+ throws IOException, InterruptedException {
+ XrancPdu sendPdu;
- int apiID = recv_pdu.getHdr().getApiId().intValue();
- log.debug("Received message: {}", recv_pdu);
+ int apiID = recvPdu.getHdr().getApiId().intValue();
+ log.debug("Received message: {}", recvPdu);
switch (apiID) {
case 1: {
// Decode Cell config report.
- CellConfigReport report = recv_pdu.getBody().getCellConfigReport();
-
- ECGI ecgi = report.getEcgi();
-
- RnibCell cell = xranStore.getCell(ecgi);
- cell.setVersion(recv_pdu.getHdr().getVer().toString());
- cell.setConf(report);
- cellMap.putPciArfcn(cell);
+ CellConfigReport report = recvPdu.getBody().getCellConfigReport();
+ handleCellconfigreport(report, recvPdu.getHdr().getVer().toString());
break;
}
case 2: {
// Decode UE Admission Request.
- UEAdmissionRequest ueAdmissionRequest = recv_pdu.getBody().getUEAdmissionRequest();
-
- ECGI ecgi = ueAdmissionRequest.getEcgi();
- if (xranStore.getCell(ecgi) != null) {
- CRNTI crnti = ueAdmissionRequest.getCrnti();
- send_pdu = UEAdmissionResponse.constructPacket(ecgi, crnti, xranConfig.admissionFlag());
- ctx.writeAndFlush(getSctpMessage(send_pdu));
- } else {
- log.warn("Could not find ECGI in registered cells: {}", ecgi);
- }
+ UEAdmissionRequest ueAdmissionRequest = recvPdu.getBody().getUEAdmissionRequest();
+ handleUeadmissionrequest(ueAdmissionRequest, ctx);
break;
}
case 4: {
// Decode UE Admission Status.
- UEAdmissionStatus ueAdmissionStatus = recv_pdu.getBody().getUEAdmissionStatus();
-
- RnibUe ue = ueMap.get(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
- if (ue != null) {
- if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
- ue.setState(RnibUe.State.ACTIVE);
- } else {
- ue.setState(RnibUe.State.IDLE);
- }
- }
-
- if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
- EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
- contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
- if (v == null) {
- v = new contextUpdateHandler();
- }
- if (v.setAdmissionStatus(ueAdmissionStatus)) {
- handleContextUpdate(v.getContextUpdate(), ctx, false);
- }
- return v;
- });
- }
+ UEAdmissionStatus ueAdmissionStatus = recvPdu.getBody().getUEAdmissionStatus();
+ handleAdmissionstatus(ueAdmissionStatus, ctx);
break;
}
case 5: {
// Decode UE Context Update.
- UEContextUpdate ueContextUpdate = recv_pdu.getBody().getUEContextUpdate();
- EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(ueContextUpdate.getEcgi(), ueContextUpdate.getCrnti());
-
- contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
- if (v == null) {
- v = new contextUpdateHandler();
- }
- if (v.setContextUpdate(ueContextUpdate)) {
- HOComplete hoComplete = v.getHoComplete();
- handleContextUpdate(ueContextUpdate, ctx, hoComplete != null);
- if (hoComplete != null) {
- try {
- hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
- } catch (InterruptedException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- e.printStackTrace();
- } finally {
- hoMap.remove(hoComplete.getEcgiS());
- }
- }
- }
- return v;
- });
+ UEContextUpdate ueContextUpdate = recvPdu.getBody().getUEContextUpdate();
+ handleUecontextupdate(ueContextUpdate, ctx);
break;
}
case 6: {
// Decode UE Reconfig_Ind.
- UEReconfigInd ueReconfigInd = recv_pdu.getBody().getUEReconfigInd();
- RnibUe ue = ueMap.get(ueReconfigInd.getEcgi(), ueReconfigInd.getCrntiOld());
-
- if (ue != null) {
- ue.setCrnti(ueReconfigInd.getCrntiNew());
- } else {
- log.warn("Could not find UE with this CRNTI: {}", ueReconfigInd.getCrntiOld());
- }
+ UEReconfigInd ueReconfigInd = recvPdu.getBody().getUEReconfigInd();
+ handleUereconfigind(ueReconfigInd);
break;
}
case 7: {
// If xRANc wants to deactivate UE, we pass UEReleaseInd from xRANc to eNB.
// Decode UE Release_Ind.
- UEReleaseInd ueReleaseInd = recv_pdu.getBody().getUEReleaseInd();
- RnibUe ue = ueMap.get(ueReleaseInd.getEcgi(), ueReleaseInd.getCrnti());
- if (ue != null) {
- ue.setState(RnibUe.State.IDLE);
- restartTimer(ue);
- }
+ UEReleaseInd ueReleaseInd = recvPdu.getBody().getUEReleaseInd();
+ handleUereleaseind(ueReleaseInd);
break;
}
case 8: {
// Decode Bearer Adm Request
- BearerAdmissionRequest bearerAdmissionRequest = recv_pdu.getBody().getBearerAdmissionRequest();
-
- ECGI ecgi = bearerAdmissionRequest.getEcgi();
- CRNTI crnti = bearerAdmissionRequest.getCrnti();
- ERABParams erabParams = bearerAdmissionRequest.getErabParams();
- RnibLink link = linkMap.get(ecgi, crnti);
- if (link != null) {
- link.setBearerParameters(erabParams);
- } else {
- log.warn("Could not find link between {}-{}", ecgi, crnti);
- }
-
- BerInteger numErabs = bearerAdmissionRequest.getNumErabs();
- // Encode and send Bearer Admission Response
- send_pdu = BearerAdmissionResponse.constructPacket(ecgi, crnti, erabParams, numErabs, xranConfig.bearerFlag());
- ctx.writeAndFlush(getSctpMessage(send_pdu));
+ BearerAdmissionRequest bearerAdmissionRequest = recvPdu.getBody().getBearerAdmissionRequest();
+ handleBeareradmissionrequest(bearerAdmissionRequest, ctx);
break;
}
case 10: {
//Decode Bearer Admission Status
- BearerAdmissionStatus bearerAdmissionStatus = recv_pdu.getBody().getBearerAdmissionStatus();
+ BearerAdmissionStatus bearerAdmissionStatus = recvPdu.getBody().getBearerAdmissionStatus();
break;
-// ECGI ecgi = bearerAdmissionStatus.getEcgi();
-// CRNTI crnti = bearerAdmissionStatus.getCrnti();
-//
-// RnibLink link = linkMap.get(ecgi, crnti);
}
case 11: {
//Decode Bearer Release Ind
- BearerReleaseInd bearerReleaseInd = recv_pdu.getBody().getBearerReleaseInd();
-
- ECGI ecgi = bearerReleaseInd.getEcgi();
- CRNTI crnti = bearerReleaseInd.getCrnti();
- RnibLink link = linkMap.get(ecgi, crnti);
-
- List<ERABID> erabidsRelease = bearerReleaseInd.getErabIds().getERABID();
- List<ERABParamsItem> erabParamsItem = link.getBearerParameters().getERABParamsItem();
-
- List<ERABParamsItem> unreleased = erabParamsItem
- .stream()
- .filter(item -> {
- Optional<ERABID> any = erabidsRelease.stream().filter(id -> id.equals(item.getId())).findAny();
- return !any.isPresent();
- }).collect(Collectors.toList());
-
- link.getBearerParameters().setERABParamsItem(new ArrayList<>(unreleased));
+ BearerReleaseInd bearerReleaseInd = recvPdu.getBody().getBearerReleaseInd();
+ handleBearerreleaseind(bearerReleaseInd);
break;
}
case 13: {
- HOFailure hoFailure = recv_pdu.getBody().getHOFailure();
-
- try {
- hoMap.get(hoFailure.getEcgi())
- .put("Hand Over Failed with cause: " + hoFailure.getCause());
- } catch (InterruptedException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- e.printStackTrace();
- } finally {
- hoMap.remove(hoFailure.getEcgi());
- ueIdQueue.take();
- }
+ HOFailure hoFailure = recvPdu.getBody().getHOFailure();
+ handleHofailure(hoFailure);
break;
}
case 14: {
- HOComplete hoComplete = recv_pdu.getBody().getHOComplete();
-
- EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(hoComplete.getEcgiT(), hoComplete.getCrntiNew());
- contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
- if (v == null) {
- v = new contextUpdateHandler();
- }
- if (v.setHoComplete(hoComplete)) {
- handleContextUpdate(v.getContextUpdate(), ctx, true);
-
- try {
- hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
- } catch (InterruptedException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- e.printStackTrace();
- } finally {
- hoMap.remove(hoComplete.getEcgiS());
- }
- }
- return v;
- });
-
+ HOComplete hoComplete = recvPdu.getBody().getHOComplete();
+ handleHocomplete(hoComplete, ctx);
break;
}
case 16: {
- // Decode RX Sig Meas Report.
- RXSigMeasReport rxSigMeasReport = recv_pdu.getBody().getRXSigMeasReport();
- List<RXSigReport> rxSigReportList = rxSigMeasReport.getCellMeasReports().getRXSigReport();
-
- RnibUe ue = ueMap.get(rxSigMeasReport.getEcgi(), rxSigMeasReport.getCrnti());
- if (ue != null) {
- Long ueId = ue.getId();
-
- if (!rxSigReportList.isEmpty()) {
- rxSigReportList.forEach(rxSigReport -> {
- RnibCell cell = cellMap.get(rxSigReport.getPciArfcn());
- if (cell != null) {
- ECGI ecgi = cell.getEcgi();
-
- RnibLink link = linkMap.get(ecgi, ueId);
- if (link == null) {
- log.warn("Could not find link between: {}-{} | Creating non-serving link..", ecgi, ueId);
- link = linkMap.putNonServingLink(cell, ueId);
- }
-
- if (link != null) {
- if (link.getType().equals(RnibLink.Type.NON_SERVING)) {
- restartTimer(link);
- }
-
- RSRQRange rsrq = rxSigReport.getRsrq();
- RSRPRange rsrp = rxSigReport.getRsrp();
-
- RnibLink.LinkQuality quality = link.getQuality();
- quality.setRX(new RnibLink.LinkQuality.RX(
- rsrp.value.intValue() - 140,
- (rsrq.value.intValue() * 0.5) - 19.5
- ));
- }
- } else {
- log.warn("case 16: Could not find cell with PCI-ARFCN: {}", rxSigReport.getPciArfcn());
- }
- });
- }
- }
+ // Decode Rx Sig Meas Report.
+ RXSigMeasReport rxSigMeasReport = recvPdu.getBody().getRXSigMeasReport();
+ handleRxsigmeasreport(rxSigMeasReport);
break;
}
case 18: {
- RadioMeasReportPerUE radioMeasReportPerUE = recv_pdu.getBody().getRadioMeasReportPerUE();
-
- RnibUe ue = ueMap.get(radioMeasReportPerUE.getEcgi(), radioMeasReportPerUE.getCrnti());
- if (ue != null) {
- Long ueId = ue.getId();
- List<RadioRepPerServCell> servCells = radioMeasReportPerUE.getRadioReportServCells().getRadioRepPerServCell();
-
- servCells.forEach(servCell -> {
- RnibCell cell = cellMap.get(servCell.getPciArfcn());
- if (cell != null) {
- RnibLink link = linkMap.get(cell.getEcgi(), ueId);
- if (link != null) {
- RadioRepPerServCell.CqiHist cqiHist = servCell.getCqiHist();
- RnibLink.LinkQuality quality = link.getQuality();
-
- final double[] values = {0, 0, 0};
- final int[] i = {1};
- cqiHist.getBerInteger().forEach(value -> {
- values[0] = Math.max(values[0], value.intValue());
- values[1] += i[0] * value.intValue();
- values[2] += value.intValue();
- i[0]++;
- });
-
- quality.setCQI(new RnibLink.LinkQuality.CQI(
- cqiHist,
- values[0],
- values[1] / values[0]
- ));
-
- } else {
- log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
- }
- } else {
- log.warn("case 18: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
- }
- });
- }
+ RadioMeasReportPerUE radioMeasReportPerUE = recvPdu.getBody().getRadioMeasReportPerUE();
+ handleRadionmeasreportperue(radioMeasReportPerUE);
break;
}
case 19: {
- RadioMeasReportPerCell radioMeasReportPerCell = recv_pdu.getBody().getRadioMeasReportPerCell();
+ RadioMeasReportPerCell radioMeasReportPerCell = recvPdu.getBody().getRadioMeasReportPerCell();
break;
}
case 20: {
- SchedMeasReportPerUE schedMeasReportPerUE = recv_pdu.getBody().getSchedMeasReportPerUE();
-
- RnibUe ue = ueMap.get(schedMeasReportPerUE.getEcgi(), schedMeasReportPerUE.getCrnti());
- if (ue != null) {
- Long ueId = ue.getId();
-
- List<SchedMeasRepPerServCell> servCells = schedMeasReportPerUE.getSchedReportServCells()
- .getSchedMeasRepPerServCell();
-
- servCells.forEach(servCell -> {
- RnibCell cell = cellMap.get(servCell.getPciArfcn());
- if (cell != null) {
- RnibLink link = linkMap.get(cell.getEcgi(), ueId);
- if (link != null) {
- link.getQuality().setMCS(new RnibLink.LinkQuality.MCS(
- servCell.getMcsDl(),
- servCell.getMcsUl()
- ));
-
- link.setResourceUsage(new RnibLink.ResourceUsage(
- servCell.getPrbUsage().getPrbUsageDl(),
- servCell.getPrbUsage().getPrbUsageUl()
- ));
- } else {
- log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
- }
- } else {
- log.warn("case 20: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
- }
- });
- }
+ SchedMeasReportPerUE schedMeasReportPerUE = recvPdu.getBody().getSchedMeasReportPerUE();
+ handleSchedmeasreportperue(schedMeasReportPerUE);
break;
}
case 21: {
- SchedMeasReportPerCell schedMeasReportPerCell = recv_pdu.getBody().getSchedMeasReportPerCell();
- RnibCell cell = cellMap.get(schedMeasReportPerCell.getEcgi());
- if (cell != null) {
- cell.setPrbUsage(new RnibCell.PrbUsageContainer(
- schedMeasReportPerCell.getPrbUsagePcell(),
- schedMeasReportPerCell.getPrbUsageScell()
- ));
-
- cell.setQci(schedMeasReportPerCell.getQciVals());
- } else {
- log.warn("Could not find cell with ECGI: {}", schedMeasReportPerCell.getEcgi());
- }
+ SchedMeasReportPerCell schedMeasReportPerCell = recvPdu.getBody().getSchedMeasReportPerCell();
+ handleSchedmeasreportpercell(schedMeasReportPerCell);
break;
}
case 22: {
- PDCPMeasReportPerUe pdcpMeasReportPerUe = recv_pdu.getBody().getPDCPMeasReportPerUe();
-
- RnibUe ue = ueMap.get(pdcpMeasReportPerUe.getEcgi(), pdcpMeasReportPerUe.getCrnti());
- if (ue != null) {
- Long ueId = ue.getId();
- RnibLink link = linkMap.get(pdcpMeasReportPerUe.getEcgi(), ueId);
- if (link != null) {
- link.setPdcpThroughput(new RnibLink.PDCPThroughput(
- pdcpMeasReportPerUe.getThroughputDl(),
- pdcpMeasReportPerUe.getThroughputUl()
- ));
-
- link.setPdcpPackDelay(new RnibLink.PDCPPacketDelay(
- pdcpMeasReportPerUe.getPktDelayDl(),
- pdcpMeasReportPerUe.getPktDelayUl()
- ));
- } else {
- log.warn("Could not find link between: {}-{}", pdcpMeasReportPerUe.getEcgi(), ueId);
- }
- }
+ PDCPMeasReportPerUe pdcpMeasReportPerUe = recvPdu.getBody().getPDCPMeasReportPerUe();
+ handlePdcpmeasreportperue(pdcpMeasReportPerUe);
break;
}
case 24: {
// Decode UE Capability Info
- UECapabilityInfo capabilityInfo = recv_pdu.getBody().getUECapabilityInfo();
-
- RnibUe ue = ueMap.get(capabilityInfo.getEcgi(), capabilityInfo.getCrnti());
- if (ue != null) {
- ue.setCapability(capabilityInfo);
- } else {
- log.warn("Could not find UE with this CRNTI: {}", capabilityInfo.getCrnti());
- }
+ UECapabilityInfo capabilityInfo = recvPdu.getBody().getUECapabilityInfo();
+ handleCapabilityinfo(capabilityInfo);
break;
}
case 25: {
// Don't know what will invoke sending UE CAPABILITY ENQUIRY
// Encode and send UE CAPABILITY ENQUIRY
- UECapabilityEnquiry ueCapabilityEnquiry = recv_pdu.getBody().getUECapabilityEnquiry();
- XrancPdu xrancPdu = UECapabilityEnquiry.constructPacket(ueCapabilityEnquiry.getEcgi(), ueCapabilityEnquiry.getCrnti());
- ctx.writeAndFlush(getSctpMessage(xrancPdu));
+ UECapabilityEnquiry ueCapabilityEnquiry = recvPdu.getBody().getUECapabilityEnquiry();
+ handleUecapabilityenquiry(ueCapabilityEnquiry, ctx);
break;
}
case 27: {
//Decode ScellAddStatus
- ScellAddStatus scellAddStatus = recv_pdu.getBody().getScellAddStatus();
- RnibUe ue = ueMap.get(scellAddStatus.getEcgi(), scellAddStatus.getCrnti());
- if (ue != null) {
- Long ueId = ue.getId();
- try {
- scellAddMap.get(scellAddStatus.getCrnti()).put("Scell's status: " + scellAddStatus.getStatus());
- if (scellAddStatus.getStatus().getBerEnum().get(0).value.intValue() == 0) {
-
- scellAddStatus.getScellsInd().getPCIARFCN().forEach(
- pciarfcn -> {
- RnibCell cell = cellMap.get(pciarfcn);
- RnibLink link = linkMap.get(cell.getEcgi(), ueId);
- link.setType(RnibLink.Type.SERVING_SECONDARY_CA);
- }
- );
- } else {
- log.error("Scell addition failed.");
- }
- } catch (InterruptedException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- e.printStackTrace();
- } finally {
- scellAddMap.remove(scellAddStatus.getCrnti());
- }
- }
+ ScellAddStatus scellAddStatus = recvPdu.getBody().getScellAddStatus();
+ handleScelladdstatus(scellAddStatus);
break;
}
- // TODO: 28: ScellDelete
case 30: {
// Decode RRMConfig Status
- RRMConfigStatus rrmConfigStatus = recv_pdu.getBody().getRRMConfigStatus();
- try {
- RRMCellMap.get(rrmConfigStatus.getEcgi())
- .put("RRM Config's status: " + rrmConfigStatus.getStatus());
- } catch (InterruptedException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- e.printStackTrace();
- } finally {
- RRMCellMap.remove(rrmConfigStatus.getEcgi());
- }
+ RRMConfigStatus rrmConfigStatus = recvPdu.getBody().getRRMConfigStatus();
+ handleRrmconfigstatus(rrmConfigStatus);
break;
}
//TODO Case 31: SeNBAdd 32: SeNBAddStatus 33: SeNBDelete
case 34: {
- TrafficSplitConfig trafficSplitConfig = recv_pdu.getBody().getTrafficSplitConfig();
-
- RnibUe ue = ueMap.get(trafficSplitConfig.getEcgi(), trafficSplitConfig.getCrnti());
- if (ue != null) {
- Long ueId = ue.getId();
- List<TrafficSplitPercentage> splitPercentages = trafficSplitConfig.getTrafficSplitPercent().getTrafficSplitPercentage();
-
- splitPercentages.forEach(trafficSplitPercentage -> {
- RnibCell cell = cellMap.get(trafficSplitPercentage.getEcgi());
- if (cell != null) {
- RnibLink link = linkMap.get(cell.getEcgi(), ueId);
- if (link != null) {
- link.setTrafficPercent(trafficSplitPercentage);
- } else {
- log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
- }
- } else {
- log.warn("Could not find cell with ECGI: {}", trafficSplitConfig.getEcgi());
- }
- });
- }
+ TrafficSplitConfig trafficSplitConfig = recvPdu.getBody().getTrafficSplitConfig();
+ handleTrafficSplitConfig(trafficSplitConfig);
break;
}
default: {
- log.warn("Wrong API ID: {}", recv_pdu);
+ log.warn("Wrong API ID: {}", recvPdu);
break;
}
}
}
+ /**
+ * Handle Cellconfigreport.
+ * @param report CellConfigReport
+ * @param version String version ID
+ */
+ private void handleCellconfigreport(CellConfigReport report, String version) {
+ ECGI ecgi = report.getEcgi();
+
+ RnibCell cell = xranStore.getCell(ecgi);
+ cell.setVersion(version);
+ cell.setConf(report);
+ cellMap.putPciArfcn(cell);
+ }
+
+ /**
+ * Handle Ueadmissionrequest.
+ * @param ueAdmissionRequest UEAdmissionRequest
+ * @param ctx ChannelHandlerContext
+ * @throws IOException IO Exception
+ */
+ private void handleUeadmissionrequest(UEAdmissionRequest ueAdmissionRequest, ChannelHandlerContext ctx)
+ throws IOException {
+ ECGI ecgi = ueAdmissionRequest.getEcgi();
+ if (xranStore.getCell(ecgi) != null) {
+ CRNTI crnti = ueAdmissionRequest.getCrnti();
+ XrancPdu sendPdu = UEAdmissionResponse.constructPacket(ecgi, crnti, xranConfig.admissionFlag());
+ ctx.writeAndFlush(getSctpMessage(sendPdu));
+ } else {
+ log.warn("Could not find ECGI in registered cells: {}", ecgi);
+ }
+ }
+
+ /**
+ * Handle UEAdmissionStatus.
+ * @param ueAdmissionStatus UEAdmissionStatus
+ * @param ctx ChannelHandlerContext
+ */
+ private void handleAdmissionstatus(UEAdmissionStatus ueAdmissionStatus, ChannelHandlerContext ctx) {
+ RnibUe ue = ueMap.get(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
+ if (ue != null) {
+ if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
+ ue.setState(RnibUe.State.ACTIVE);
+ } else {
+ ue.setState(RnibUe.State.IDLE);
+ }
+ }
+
+ if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
+ EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair
+ .valueOf(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
+ contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
+ if (v == null) {
+ v = new ContextUpdateHandler();
+ }
+ if (v.setAdmissionStatus(ueAdmissionStatus)) {
+ handleContextUpdate(v.getContextUpdate(), ctx, false);
+ }
+ return v;
+ });
+ }
+ }
+
+ /**
+ * Handle UEContextUpdate.
+ * @param ueContextUpdate UEContextUpdate
+ * @param ctx ChannelHandlerContext
+ */
+ private void handleUecontextupdate(UEContextUpdate ueContextUpdate, ChannelHandlerContext ctx) {
+ EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair
+ .valueOf(ueContextUpdate.getEcgi(), ueContextUpdate.getCrnti());
+
+ contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
+ if (v == null) {
+ v = new ContextUpdateHandler();
+ }
+ if (v.setContextUpdate(ueContextUpdate)) {
+ HOComplete hoComplete = v.getHoComplete();
+ handleContextUpdate(ueContextUpdate, ctx, hoComplete != null);
+ if (hoComplete != null) {
+ try {
+ hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
+ } catch (InterruptedException e) {
+ log.error(ExceptionUtils.getFullStackTrace(e));
+ e.printStackTrace();
+ } finally {
+ hoMap.remove(hoComplete.getEcgiS());
+ }
+ }
+ }
+ return v;
+ });
+ }
+
+ /**
+ * Handle UEReconfigInd.
+ * @param ueReconfigInd UEReconfigInd
+ */
+ private void handleUereconfigind(UEReconfigInd ueReconfigInd) {
+ RnibUe ue = ueMap.get(ueReconfigInd.getEcgi(), ueReconfigInd.getCrntiOld());
+ RnibCell cell = cellMap.get(ueReconfigInd.getEcgi());
+
+ if (ue != null && cell != null) {
+ ue.setCrnti(ueReconfigInd.getCrntiNew());
+ ueMap.putCrnti(cell, ue);
+ } else {
+ log.warn("Could not find UE with this CRNTI: {}", ueReconfigInd.getCrntiOld());
+ }
+ }
+
+ /**
+ * Handle UEReleaseInd.
+ * @param ueReleaseInd UEReleaseInd
+ */
+ private void handleUereleaseind(UEReleaseInd ueReleaseInd) {
+ ECGI ecgi = ueReleaseInd.getEcgi();
+ CRNTI crnti = ueReleaseInd.getCrnti();
+ RnibUe ue = ueMap.get(ecgi, crnti);
+
+ // Check if there is an ongoing handoff and only remove if ue is not part of the handoff.
+ Long peek = ueIdQueue.peek();
+ if (peek != null) {
+ EcgiCrntiPair ecgiCrntiPair = ueMap.getCrntUe().inverse().get(peek);
+ if (ecgiCrntiPair != null && ecgiCrntiPair.equals(EcgiCrntiPair.valueOf(ecgi, crnti))) {
+ return;
+ }
+ }
+
+ if (ue != null) {
+ ue.setState(RnibUe.State.IDLE);
+ restartTimer(ue);
+ } else {
+ log.warn("Cannot release UE from non primary link.");
+ }
+ }
+
+ /**
+ * Handle BearerAdmissionRequest.
+ * @param bearerAdmissionRequest BearerAdmissionRequest
+ * @param ctx ChannelHandlerContext
+ * @throws IOException IO Exception
+ */
+ private void handleBeareradmissionrequest(BearerAdmissionRequest bearerAdmissionRequest,
+ ChannelHandlerContext ctx) throws IOException {
+ ECGI ecgi = bearerAdmissionRequest.getEcgi();
+ CRNTI crnti = bearerAdmissionRequest.getCrnti();
+ ERABParams erabParams = bearerAdmissionRequest.getErabParams();
+ RnibLink link = linkMap.get(ecgi, crnti);
+ if (link != null) {
+ link.setBearerParameters(erabParams);
+ } else {
+ log.warn("Could not find link between {}-{}", ecgi, crnti);
+ }
+
+ BerInteger numErabs = bearerAdmissionRequest.getNumErabs();
+ // Encode and send Bearer Admission Response
+ XrancPdu sendPdu = BearerAdmissionResponse
+ .constructPacket(ecgi, crnti, erabParams, numErabs, xranConfig.bearerFlag());
+ ctx.writeAndFlush(getSctpMessage(sendPdu));
+ }
+
+ /**
+ * Handle BearerReleaseInd.
+ * @param bearerReleaseInd
+ */
+ private void handleBearerreleaseind(BearerReleaseInd bearerReleaseInd) {
+ ECGI ecgi = bearerReleaseInd.getEcgi();
+ CRNTI crnti = bearerReleaseInd.getCrnti();
+ RnibLink link = linkMap.get(ecgi, crnti);
+
+ List<ERABID> erabidsRelease = bearerReleaseInd.getErabIds().getERABID();
+ List<ERABParamsItem> erabParamsItem = link.getBearerParameters().getERABParamsItem();
+
+ List<ERABParamsItem> unreleased = erabParamsItem
+ .stream()
+ .filter(item -> {
+ Optional<ERABID> any = erabidsRelease.stream()
+ .filter(id -> id.equals(item.getId())).findAny();
+ return !any.isPresent();
+ }).collect(Collectors.toList());
+
+ link.getBearerParameters().setERABParamsItem(new ArrayList<>(unreleased));
+ }
+
+ /**
+ * Handle HOFailure.
+ * @param hoFailure HOFailure
+ * @throws InterruptedException ueIdQueue interruption
+ */
+ private void handleHofailure(HOFailure hoFailure) throws InterruptedException {
+ try {
+ hoMap.get(hoFailure.getEcgi())
+ .put("Hand Over Failed with cause: " + hoFailure.getCause());
+ } catch (InterruptedException e) {
+ log.error(ExceptionUtils.getFullStackTrace(e));
+ e.printStackTrace();
+ } finally {
+ hoMap.remove(hoFailure.getEcgi());
+ ueIdQueue.take();
+ }
+ }
+
+ /**
+ * Handle HOComplete.
+ * @param hoComplete HOComplete
+ * @param ctx ChannelHandlerContext
+ */
+ private void handleHocomplete(HOComplete hoComplete, ChannelHandlerContext ctx) {
+ EcgiCrntiPair ecgiCrntiPair = EcgiCrntiPair.valueOf(hoComplete.getEcgiT(),
+ hoComplete.getCrntiNew());
+ contextUpdateMap.compute(ecgiCrntiPair, (k, v) -> {
+ if (v == null) {
+ v = new ContextUpdateHandler();
+ }
+ if (v.setHoComplete(hoComplete)) {
+ handleContextUpdate(v.getContextUpdate(), ctx, true);
+
+ try {
+ hoMap.get(hoComplete.getEcgiS()).put("Hand Over Completed");
+ } catch (InterruptedException e) {
+ log.error(ExceptionUtils.getFullStackTrace(e));
+ e.printStackTrace();
+ } finally {
+ hoMap.remove(hoComplete.getEcgiS());
+ }
+ }
+ return v;
+ });
+ }
+
+ /**
+ * Handle RXSigMeasReport.
+ * @param rxSigMeasReport RXSigMeasReport
+ */
+ private void handleRxsigmeasreport(RXSigMeasReport rxSigMeasReport) {
+ List<RXSigReport> rxSigReportList = rxSigMeasReport.getCellMeasReports().getRXSigReport();
+
+ RnibUe ue = ueMap.get(rxSigMeasReport.getEcgi(), rxSigMeasReport.getCrnti());
+ if (ue != null) {
+ Long ueId = ue.getId();
+
+ if (!rxSigReportList.isEmpty()) {
+ rxSigReportList.forEach(rxSigReport -> {
+ RnibCell cell = cellMap.get(rxSigReport.getPciArfcn());
+ if (cell != null) {
+ ECGI ecgi = cell.getEcgi();
+
+ RnibLink link = linkMap.get(ecgi, ueId);
+ if (link == null) {
+ log.warn("Could not find link between: {}-{} | Creating non-serving link..",
+ ecgi, ueId);
+ link = linkMap.putNonServingLink(cell, ueId);
+ }
+
+ if (link != null) {
+ if (link.getType().equals(RnibLink.Type.NON_SERVING)) {
+ restartTimer(link);
+ }
+
+ RSRQRange rsrq = rxSigReport.getRsrq();
+ RSRPRange rsrp = rxSigReport.getRsrp();
+
+ RnibLink.LinkQuality quality = link.getQuality();
+ quality.setRx(new RnibLink.LinkQuality.Rx(
+ rsrp.value.intValue() - 140,
+ (rsrq.value.intValue() * 0.5) - 19.5
+ ));
+ }
+ } else {
+ log.warn("case 16: Could not find cell with PCI-ARFCN: {}",
+ rxSigReport.getPciArfcn());
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Handle RadioMeasReportPerUE.
+ * @param radioMeasReportPerUE RadioMeasReportPerUE
+ */
+ private void handleRadionmeasreportperue(RadioMeasReportPerUE radioMeasReportPerUE) {
+ RnibUe ue = ueMap.get(radioMeasReportPerUE.getEcgi(), radioMeasReportPerUE.getCrnti());
+ if (ue != null) {
+ Long ueId = ue.getId();
+ List<RadioRepPerServCell> servCells = radioMeasReportPerUE.getRadioReportServCells()
+ .getRadioRepPerServCell();
+
+ servCells.forEach(servCell -> {
+ RnibCell cell = cellMap.get(servCell.getPciArfcn());
+ if (cell != null) {
+ RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+ if (link != null) {
+ RadioRepPerServCell.CqiHist cqiHist = servCell.getCqiHist();
+ RnibLink.LinkQuality quality = link.getQuality();
+
+ final double[] values = {0, 0, 0};
+ final int[] i = {1};
+ cqiHist.getBerInteger().forEach(value -> {
+ values[0] = Math.max(values[0], value.intValue());
+ values[1] += i[0] * value.intValue();
+ values[2] += value.intValue();
+ i[0]++;
+ });
+
+ quality.setCqi(new RnibLink.LinkQuality.Cqi(
+ cqiHist,
+ values[0],
+ values[1] / values[0]
+ ));
+
+ } else {
+ log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
+ }
+ } else {
+ log.warn("case 18: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
+ }
+ });
+ }
+ }
+
+ /**
+ * Handle SchedMeasReportPerUE.
+ * @param schedMeasReportPerUE SchedMeasReportPerUE
+ */
+ private void handleSchedmeasreportperue(SchedMeasReportPerUE schedMeasReportPerUE) {
+ RnibUe ue = ueMap.get(schedMeasReportPerUE.getEcgi(), schedMeasReportPerUE.getCrnti());
+ if (ue != null) {
+ Long ueId = ue.getId();
+
+ List<SchedMeasRepPerServCell> servCells = schedMeasReportPerUE.getSchedReportServCells()
+ .getSchedMeasRepPerServCell();
+
+ servCells.forEach(servCell -> {
+ RnibCell cell = cellMap.get(servCell.getPciArfcn());
+ if (cell != null) {
+ RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+ if (link != null) {
+ link.getQuality().setMcs(new RnibLink.LinkQuality.Mcs(
+ servCell.getMcsDl(),
+ servCell.getMcsUl()
+ ));
+
+ link.setResourceUsage(new RnibLink.ResourceUsage(
+ servCell.getPrbUsage().getPrbUsageDl(),
+ servCell.getPrbUsage().getPrbUsageUl()
+ ));
+ } else {
+ log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
+ }
+ } else {
+ log.warn("case 20: Could not find cell with PCI-ARFCN: {}", servCell.getPciArfcn());
+ }
+ });
+ }
+ }
+
+ /**
+ * Handle SchedMeasReportPerCell.
+ * @param schedMeasReportPerCell SchedMeasReportPerCell
+ */
+ private void handleSchedmeasreportpercell(SchedMeasReportPerCell schedMeasReportPerCell) {
+ RnibCell cell = cellMap.get(schedMeasReportPerCell.getEcgi());
+ if (cell != null) {
+ cell.setPrbUsage(new RnibCell.PrbUsageContainer(
+ schedMeasReportPerCell.getPrbUsagePcell(),
+ schedMeasReportPerCell.getPrbUsageScell()
+ ));
+
+ cell.setQci(schedMeasReportPerCell.getQciVals());
+ } else {
+ log.warn("Could not find cell with ECGI: {}", schedMeasReportPerCell.getEcgi());
+ }
+ }
+
+ /**
+ * Handle PDCPMeasReportPerUe.
+ * @param pdcpMeasReportPerUe PDCPMeasReportPerUe
+ */
+ private void handlePdcpmeasreportperue(PDCPMeasReportPerUe pdcpMeasReportPerUe) {
+ RnibUe ue = ueMap.get(pdcpMeasReportPerUe.getEcgi(), pdcpMeasReportPerUe.getCrnti());
+ if (ue != null) {
+ Long ueId = ue.getId();
+ RnibLink link = linkMap.get(pdcpMeasReportPerUe.getEcgi(), ueId);
+ if (link != null) {
+ link.setPdcpThroughput(new RnibLink.PdcpThroughput(
+ pdcpMeasReportPerUe.getThroughputDl(),
+ pdcpMeasReportPerUe.getThroughputUl()
+ ));
+
+ link.setPdcpPackDelay(new RnibLink.PdcpPacketdelay(
+ pdcpMeasReportPerUe.getPktDelayDl(),
+ pdcpMeasReportPerUe.getPktDelayUl()
+ ));
+ } else {
+ log.warn("Could not find link between: {}-{}", pdcpMeasReportPerUe.getEcgi(), ueId);
+ }
+ }
+ }
+
+ /**
+ * Handle UECapabilityInfo.
+ * @param capabilityInfo UECapabilityInfo
+ */
+ private void handleCapabilityinfo(UECapabilityInfo capabilityInfo) {
+ RnibUe ue = ueMap.get(capabilityInfo.getEcgi(), capabilityInfo.getCrnti());
+ if (ue != null) {
+ ue.setCapability(capabilityInfo);
+ } else {
+ log.warn("Could not find UE with this CRNTI: {}", capabilityInfo.getCrnti());
+ }
+ }
+
+ /**
+ * Handle UECapabilityEnquiry.
+ * @param ueCapabilityEnquiry UECapabilityEnquiry
+ * @param ctx ChannelHandlerContext
+ * @throws IOException IO Exception
+ */
+ private void handleUecapabilityenquiry(UECapabilityEnquiry ueCapabilityEnquiry, ChannelHandlerContext ctx)
+ throws IOException {
+ XrancPdu xrancPdu = UECapabilityEnquiry.constructPacket(ueCapabilityEnquiry.getEcgi(),
+ ueCapabilityEnquiry.getCrnti());
+ ctx.writeAndFlush(getSctpMessage(xrancPdu));
+ }
+
+ /**
+ * Handle ScellAddStatus.
+ * @param scellAddStatus ScellAddStatus
+ */
+ private void handleScelladdstatus(ScellAddStatus scellAddStatus) {
+ RnibUe ue = ueMap.get(scellAddStatus.getEcgi(), scellAddStatus.getCrnti());
+ if (ue != null) {
+ Long ueId = ue.getId();
+ try {
+ scellAddMap.get(scellAddStatus.getCrnti()).put("Scell's status: " +
+ scellAddStatus.getStatus());
+ final int[] i = {0};
+ scellAddStatus.getScellsInd().getPCIARFCN().forEach(
+ pciarfcn -> {
+ if (scellAddStatus.getStatus().getBerEnum().get(i[0]).value.intValue() == 0) {
+ RnibCell cell = cellMap.get(pciarfcn);
+ RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+ link.setType(RnibLink.Type.SERVING_SECONDARY_CA);
+ }
+ i[0]++;
+ }
+ );
+
+ } catch (InterruptedException e) {
+ log.error(ExceptionUtils.getFullStackTrace(e));
+ e.printStackTrace();
+ } finally {
+ scellAddMap.remove(scellAddStatus.getCrnti());
+ }
+ }
+ }
+
+ /**
+ * Handle RRMConfigStatus.
+ * @param rrmConfigStatus RRMConfigStatus
+ */
+ private void handleRrmconfigstatus(RRMConfigStatus rrmConfigStatus) {
+ try {
+ rrmcellMap.get(rrmConfigStatus.getEcgi())
+ .put("RRM Config's status: " + rrmConfigStatus.getStatus());
+ } catch (InterruptedException e) {
+ log.error(ExceptionUtils.getFullStackTrace(e));
+ e.printStackTrace();
+ } finally {
+ rrmcellMap.remove(rrmConfigStatus.getEcgi());
+ }
+ }
+
+ /**
+ * Handle TrafficSplitConfig.
+ * @param trafficSplitConfig TrafficSplitConfig
+ */
+ private void handleTrafficSplitConfig(TrafficSplitConfig trafficSplitConfig) {
+ RnibUe ue = ueMap.get(trafficSplitConfig.getEcgi(), trafficSplitConfig.getCrnti());
+ if (ue != null) {
+ Long ueId = ue.getId();
+ List<TrafficSplitPercentage> splitPercentages = trafficSplitConfig
+ .getTrafficSplitPercent().getTrafficSplitPercentage();
+
+ splitPercentages.forEach(trafficSplitPercentage -> {
+ RnibCell cell = cellMap.get(trafficSplitPercentage.getEcgi());
+ if (cell != null) {
+ RnibLink link = linkMap.get(cell.getEcgi(), ueId);
+ if (link != null) {
+ link.setTrafficPercent(trafficSplitPercentage);
+ } else {
+ log.warn("Could not find link between: {}-{}", cell.getEcgi(), ueId);
+ }
+ } else {
+ log.warn("Could not find cell with ECGI: {}", trafficSplitConfig.getEcgi());
+ }
+ });
+ }
+ }
+
+ /**
+ * Handle context update depending if its handoff or not.
+ *
+ * @param contextUpdate context update packet
+ * @param ctx channel context for the CELL
+ * @param handoff true if we handle a Hand Off
+ */
private void handleContextUpdate(UEContextUpdate contextUpdate, ChannelHandlerContext ctx, boolean handoff) {
RnibUe ue;
RnibCell cell = xranStore.getCell(contextUpdate.getEcgi());
@@ -1078,6 +1366,9 @@
}
}
+ /**
+ * Internal class for NetworkConfigListener.
+ */
class InternalNetworkConfigListener implements NetworkConfigListener {
@Override
@@ -1100,6 +1391,11 @@
}
}
+ /**
+ * Handle config event.
+ *
+ * @param config
+ */
private void handleConfigEvent(Optional<Config> config) {
if (!config.isPresent()) {
return;
@@ -1107,7 +1403,7 @@
xranConfig = (XranConfig) config.get();
- northbound_timeout = xranConfig.getNorthBoundTimeout();
+ northboundTimeout = xranConfig.getNorthBoundTimeout();
legitCells.putAll(xranConfig.activeCellSet());
diff --git a/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.java b/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.java
index b81a628..a322c47 100644
--- a/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.java
+++ b/src/main/java/org.onosproject.xran/controller/XranDeviceAgent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +19,24 @@
import io.netty.channel.ChannelHandlerContext;
/**
- * Created by dimitris on 7/27/17.
+ * Xran device agent interface.
*/
public interface XranDeviceAgent {
+ /**
+ * Add connected CELL.
+ *
+ * @param host IP of host trying to connect
+ * @param ctx channel of CELL speaking to
+ * @return true if succeeded
+ */
boolean addConnectedCell(String host, ChannelHandlerContext ctx);
+ /**
+ * Remove disconnected CELL.
+ *
+ * @param host IP of host disconnected
+ * @return true if remove succeeded
+ */
boolean removeConnectedCell(String host);
}
diff --git a/src/main/java/org.onosproject.xran/controller/XranHostAgent.java b/src/main/java/org.onosproject.xran/controller/XranHostAgent.java
index 07ab26e..9c335da 100644
--- a/src/main/java/org.onosproject.xran/controller/XranHostAgent.java
+++ b/src/main/java/org.onosproject.xran/controller/XranHostAgent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,25 @@
import org.onosproject.xran.entities.RnibUe;
/**
- * Created by dimitris on 7/28/17.
+ * Xran host agent interface.
*/
public interface XranHostAgent {
+
+ /**
+ * Add connected host.
+ *
+ * @param ue UE entity
+ * @param cell CELL entity
+ * @param ctx channel of CELL
+ * @return true if succeeded
+ */
boolean addConnectedHost(RnibUe ue, RnibCell cell, ChannelHandlerContext ctx);
+ /**
+ * Remove disconnected host.
+ *
+ * @param ue UE entity
+ * @return true if remove succeeded
+ */
boolean removeConnectedHost(RnibUe ue);
}
diff --git a/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.java b/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.java
index 73cb587..893b21d 100644
--- a/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.java
+++ b/src/main/java/org.onosproject.xran/controller/XranPacketProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,21 @@
package org.onosproject.xran.controller;
import io.netty.channel.ChannelHandlerContext;
-import org.onosproject.net.DeviceId;
import org.onosproject.xran.codecs.pdu.XrancPdu;
import java.io.IOException;
+/**
+ * Xran packet processor interface.
+ */
public interface XranPacketProcessor {
+ /**
+ * Handle an incoming packet.
+ *
+ * @param pdu pdu of incoming packet
+ * @param ctx channel received the packet
+ * @throws IOException io exception
+ * @throws InterruptedException interrupted exception
+ */
void handlePacket(XrancPdu pdu, ChannelHandlerContext ctx) throws IOException, InterruptedException;
}
diff --git a/src/main/java/org.onosproject.xran/controller/package-info.java b/src/main/java/org.onosproject.xran/controller/package-info.java
index 7f4660f..866c396 100644
--- a/src/main/java/org.onosproject.xran/controller/package-info.java
+++ b/src/main/java/org.onosproject.xran/controller/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/entities/RnibCell.java b/src/main/java/org.onosproject.xran/entities/RnibCell.java
index ac29eba..c7ffe69 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibCell.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibCell.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,11 @@
package org.onosproject.xran.entities;
-import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.JsonNode;
import org.onosproject.net.DeviceId;
import org.onosproject.store.service.WallClockTimestamp;
@@ -41,10 +45,10 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-/**
- * Created by dimitris on 7/22/17.
- */
+/**
+ * R-NIB Cell and its properties.
+ */
@JsonPropertyOrder({
"ECGI",
"Configuration",
@@ -81,6 +85,12 @@
rrmConfig.setEcgi(ecgi);
}
+ /**
+ * Encode ECGI and obtain its URI.
+ *
+ * @param ecgi ECGI
+ * @return URI
+ */
public static URI uri(ECGI ecgi) {
if (ecgi != null) {
try {
@@ -95,6 +105,13 @@
return null;
}
+ /**
+ * Obtain ECGI from the device ID.
+ *
+ * @param deviceId ID of the device
+ * @return ECGI
+ * @throws IOException I0 Exception for ByteArrayInputStream
+ */
public static ECGI decodeDeviceId(DeviceId deviceId) throws IOException {
String uri = deviceId.toString();
String hexEcgi = uri.substring(uri.lastIndexOf("xran:") + 5);
@@ -107,65 +124,120 @@
return ecgi;
}
+ /**
+ * Get version ID.
+ *
+ * @return version ID
+ */
public int getVersion() {
return Integer.parseInt(version);
}
+ /**
+ * Set version ID.
+ *
+ * @param version version ID
+ */
public void setVersion(String version) {
this.version = version;
}
+ /**
+ * Get RRMConfig.
+ *
+ * @return RRMConfig
+ */
@JsonProperty("RRMConfiguration")
public RRMConfig getRrmConfig() {
return rrmConfig;
}
+ /**
+ * Set RRMConfig properties.
+ *
+ * @param rrmConfig RRMConfig
+ */
@JsonProperty("RRMConfiguration")
public void setRrmConfig(RRMConfig rrmConfig) {
this.rrmConfig = rrmConfig;
}
+ /**
+ * Get PRB Usage.
+ * @return prb usage
+ */
@JsonProperty("PRB-Usage")
public PrbUsageContainer getPrbUsage() {
return prbUsage;
}
+ /**
+ * Set PRB Usage.
+ *
+ * @param prbUsage prb Usage
+ */
@JsonProperty("PRB-Usage")
public void setPrbUsage(PrbUsageContainer prbUsage) {
this.prbUsage = prbUsage;
}
+ /**
+ * Get ECGI.
+ *
+ * @return ECGI
+ */
@JsonProperty("ECGI")
public ECGI getEcgi() {
return ecgi;
}
+ /**
+ * Set ECGI.
+ *
+ * @param ecgi ECGI
+ */
@JsonProperty("ECGI")
public void setEcgi(ECGI ecgi) {
this.ecgi = ecgi;
}
+ /**
+ * Get cell config report.
+ *
+ * @return CellConfig Report
+ */
@JsonProperty("Configuration")
public CellConfigReport getConf() {
return conf;
}
+ /**
+ * Set cell config report.
+ *
+ * @param conf Cell config report
+ */
@JsonProperty("Configuration")
public void setConf(CellConfigReport conf) {
this.conf = conf;
}
+ /**
+ * Modify the RRM Config parameters of cell.
+ *
+ * @param rrmConfigNode RRMConfig parameters to modify obtained from REST call
+ * @param ueList List of all UEs
+ * @throws Exception p_a size not equal to UE size
+ */
public void modifyRrmConfig(JsonNode rrmConfigNode, List<RnibUe> ueList) throws Exception {
RRMConfig.Crnti crnti = new RRMConfig.Crnti();
ueList.forEach(ue -> crnti.addCRNTI(ue.getCrnti()));
- {
- JsonNode p_a = rrmConfigNode.path("p_a");
- if (!p_a.isMissingNode()) {
+ JsonNode pA = rrmConfigNode.path("p_a");
+ if (!pA.isMissingNode()) {
RRMConfig.Pa pa = new RRMConfig.Pa();
- if (p_a.isArray()) {
- if (ueList.size() == p_a.size()) {
- List<XICICPA> collect = Stream.of(p_a)
+ if (pA.isArray()) {
+ if (ueList.size() == pA.size()) {
+ List<XICICPA> collect = Stream.of(pA)
.map(val -> new XICICPA(val.asInt()))
.collect(Collectors.toList());
pa.setXICICPA(collect);
@@ -175,15 +247,13 @@
}
rrmConfig.setPa(pa);
}
- }
- {
- JsonNode start_prb_dl = rrmConfigNode.path("start_prb_dl");
- if (!start_prb_dl.isMissingNode()) {
+ JsonNode startPrbDl1 = rrmConfigNode.path("start_prb_dl");
+ if (!startPrbDl1.isMissingNode()) {
RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
- if (start_prb_dl.isArray()) {
- if (ueList.size() == start_prb_dl.size()) {
- List<BerInteger> collect = Stream.of(start_prb_dl)
+ if (startPrbDl1.isArray()) {
+ if (ueList.size() == startPrbDl1.size()) {
+ List<BerInteger> collect = Stream.of(startPrbDl1)
.map(val -> new BerInteger(val.asInt()))
.collect(Collectors.toList());
startPrbDl.setSeqOf(collect);
@@ -193,15 +263,13 @@
}
rrmConfig.setStartPrbDl(startPrbDl);
}
- }
- {
- JsonNode end_prb_dl = rrmConfigNode.path("end_prb_dl");
- if (!end_prb_dl.isMissingNode()) {
+ JsonNode endPrbDl1 = rrmConfigNode.path("end_prb_dl");
+ if (!endPrbDl1.isMissingNode()) {
RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
- if (end_prb_dl.isArray()) {
- if (ueList.size() == end_prb_dl.size()) {
- List<BerInteger> collect = Stream.of(end_prb_dl)
+ if (endPrbDl1.isArray()) {
+ if (ueList.size() == endPrbDl1.size()) {
+ List<BerInteger> collect = Stream.of(endPrbDl1)
.map(val -> new BerInteger(val.asInt()))
.collect(Collectors.toList());
endPrbDl.setSeqOf(collect);
@@ -211,14 +279,12 @@
}
rrmConfig.setEndPrbDl(endPrbDl);
}
- }
- {
- JsonNode sub_frame_bitmask_dl = rrmConfigNode.path("sub_frame_bitmask_dl");
- if (!sub_frame_bitmask_dl.isMissingNode()) {
+ JsonNode frameBitmaskDl = rrmConfigNode.path("sub_frame_bitmask_dl");
+ if (!frameBitmaskDl.isMissingNode()) {
RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl();
- if (sub_frame_bitmask_dl.isArray()) {
- List<BerBitString> collect = Stream.of(sub_frame_bitmask_dl)
+ if (frameBitmaskDl.isArray()) {
+ List<BerBitString> collect = Stream.of(frameBitmaskDl)
.map(val -> new BerBitString(DatatypeConverter.parseHexBinary(val.asText()), 10))
.collect(Collectors.toList());
@@ -228,15 +294,13 @@
}
rrmConfig.setSubframeBitmaskDl(subframeBitmaskDl);
}
- }
- {
- JsonNode start_prb_ul = rrmConfigNode.path("start_prb_ul");
- if (!start_prb_ul.isMissingNode()) {
+ JsonNode startPrbUl1 = rrmConfigNode.path("start_prb_ul");
+ if (!startPrbUl1.isMissingNode()) {
RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl();
- if (start_prb_ul.isArray()) {
- if (ueList.size() == start_prb_ul.size()) {
- List<BerInteger> collect = Stream.of(start_prb_ul)
+ if (startPrbUl1.isArray()) {
+ if (ueList.size() == startPrbUl1.size()) {
+ List<BerInteger> collect = Stream.of(startPrbUl1)
.map(val -> new BerInteger(val.asInt()))
.collect(Collectors.toList());
startPrbUl.setSeqOf(collect);
@@ -246,15 +310,13 @@
}
rrmConfig.setStartPrbUl(startPrbUl);
}
- }
- {
- JsonNode end_prb_ul = rrmConfigNode.path("end_prb_ul");
- if (!end_prb_ul.isMissingNode()) {
+ JsonNode endPrbUl1 = rrmConfigNode.path("end_prb_ul");
+ if (!endPrbUl1.isMissingNode()) {
RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl();
- if (end_prb_ul.isArray()) {
- if (ueList.size() == end_prb_ul.size()) {
- List<BerInteger> collect = Stream.of(end_prb_ul)
+ if (endPrbUl1.isArray()) {
+ if (ueList.size() == endPrbUl1.size()) {
+ List<BerInteger> collect = Stream.of(endPrbUl1)
.map(val -> new BerInteger(val.asInt()))
.collect(Collectors.toList());
endPrbUl.setSeqOf(collect);
@@ -264,15 +326,13 @@
}
rrmConfig.setEndPrbUl(endPrbUl);
}
- }
- {
- JsonNode p0_ue_pusch = rrmConfigNode.path("p0_ue_pusch");
- if (!p0_ue_pusch.isMissingNode()) {
+ JsonNode uePusch = rrmConfigNode.path("p0_ue_pusch");
+ if (!uePusch.isMissingNode()) {
RRMConfig.P0UePusch p0UePusch = new RRMConfig.P0UePusch();
- if (p0_ue_pusch.isArray()) {
- if (ueList.size() == p0_ue_pusch.size()) {
- List<BerInteger> collect = Stream.of(p0_ue_pusch)
+ if (uePusch.isArray()) {
+ if (ueList.size() == uePusch.size()) {
+ List<BerInteger> collect = Stream.of(uePusch)
.map(val -> new BerInteger(val.asInt()))
.collect(Collectors.toList());
p0UePusch.setSeqOf(collect);
@@ -282,14 +342,12 @@
}
rrmConfig.setP0UePusch(p0UePusch);
}
- }
- {
- JsonNode sub_frame_bitmask_ul = rrmConfigNode.path("sub_frame_bitmask_ul");
- if (!sub_frame_bitmask_ul.isMissingNode()) {
+ JsonNode frameBitmaskUl = rrmConfigNode.path("sub_frame_bitmask_ul");
+ if (!frameBitmaskUl.isMissingNode()) {
RRMConfig.SubframeBitmaskUl subframeBitmaskUl = new RRMConfig.SubframeBitmaskUl();
- if (sub_frame_bitmask_ul.isArray()) {
- List<BerBitString> collect = Stream.of(sub_frame_bitmask_ul)
+ if (frameBitmaskUl.isArray()) {
+ List<BerBitString> collect = Stream.of(frameBitmaskUl)
.map(val -> new BerBitString(DatatypeConverter.parseHexBinary(val.asText()), 10))
.collect(Collectors.toList());
@@ -299,26 +357,45 @@
}
rrmConfig.setSubframeBitmaskUl(subframeBitmaskUl);
}
- }
rrmConfig.setCrnti(crnti);
}
+ /**
+ * Get QCI values.
+ *
+ * @return QCI values
+ */
@JsonProperty("QCI")
public SchedMeasReportPerCell.QciVals getQci() {
return qci;
}
+ /**
+ * Set QCI values.
+ *
+ * @param qci QCI
+ */
@JsonProperty("QCI")
public void setQci(SchedMeasReportPerCell.QciVals qci) {
this.qci = qci;
}
+ /**
+ * Get L2 measurement config.
+ *
+ * @return L2MeasConfig
+ */
@JsonProperty("MeasurementConfiguration")
public L2MeasConfig getMeasConfig() {
return measConfig;
}
+ /**
+ * Set L2 measurement config.
+ *
+ * @param measConfig l2MeasConfig
+ */
@JsonProperty("MeasurementConfiguration")
public void setMeasConfig(L2MeasConfig measConfig) {
this.measConfig = measConfig;
@@ -337,21 +414,38 @@
'}';
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals()
+ */
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
RnibCell rnibCell = (RnibCell) o;
return ecgi.equals(rnibCell.ecgi);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
@Override
public int hashCode() {
return ecgi.hashCode();
}
+ /**
+ * Container class for PRBUsage.
+ */
@JsonPropertyOrder({
"primary",
"secondary",
@@ -364,33 +458,65 @@
WallClockTimestamp timesincelastupdate;
@JsonCreator
- public PrbUsageContainer(@JsonProperty("primary") PRBUsage primary, @JsonProperty("secondary") PRBUsage secondary) {
+ public PrbUsageContainer(@JsonProperty("primary") PRBUsage primary,
+ @JsonProperty("secondary") PRBUsage secondary) {
this.primary = primary;
this.secondary = secondary;
this.timesincelastupdate = new WallClockTimestamp();
}
+ /**
+ * Get primary PRBUsage.
+ *
+ * @return PRBUsage
+ */
public PRBUsage getPrimary() {
return primary;
}
+ /**
+ * Set secondary PRBUsage.
+ *
+ * @param primary PRBUsage
+ */
public void setPrimary(PRBUsage primary) {
this.primary = primary;
}
+ /**
+ * Get secondary PRBUsage.
+ *
+ * @return PRBUsage
+ */
public PRBUsage getSecondary() {
return secondary;
}
+ /**
+ * Set secondary PRBUsage.
+ *
+ * @param secondary PRBUsage
+ */
public void setSecondary(PRBUsage secondary) {
this.secondary = secondary;
}
- public long getTimesincelastupdate() {
+ /**
+ * Get time since last update.
+ *
+ * @return long Time
+ */
+ public long getTimeSinceLastUpdate() {
return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
}
- public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
+
+ /**
+ * Set time since last update.
+ *
+ * @param timesincelastupdate time since last update
+ */
+ public void setTimeSinceLastUpdate(WallClockTimestamp timesincelastupdate) {
this.timesincelastupdate = timesincelastupdate;
}
@@ -399,7 +525,8 @@
return "PrbUsageContainer{" +
"primary=" + primary +
", secondary=" + secondary +
- ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+ ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+ timesincelastupdate.unixTimestamp()) +
'}';
}
}
diff --git a/src/main/java/org.onosproject.xran/entities/RnibLink.java b/src/main/java/org.onosproject.xran/entities/RnibLink.java
index 13a0d93..4eb18a8 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibLink.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibLink.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +16,20 @@
package org.onosproject.xran.entities;
-import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Lists;
import org.onosproject.store.service.WallClockTimestamp;
-import org.onosproject.xran.codecs.api.*;
+import org.onosproject.xran.codecs.api.ERABParams;
+import org.onosproject.xran.codecs.api.RadioRepPerServCell;
+import org.onosproject.xran.codecs.api.TrafficSplitPercentage;
+import org.onosproject.xran.codecs.api.XICICPA;
+import org.onosproject.xran.codecs.api.SchedMeasRepPerServCell;
+import org.onosproject.xran.codecs.api.PRBUsage;
import org.onosproject.xran.codecs.ber.types.BerBitString;
import org.onosproject.xran.codecs.ber.types.BerInteger;
import org.onosproject.xran.codecs.pdu.PDCPMeasReportPerUe;
@@ -36,7 +45,7 @@
import java.util.Timer;
/**
- * Created by dimitris on 7/22/17.
+ * R-NIB Link and its properties.
*/
@JsonPropertyOrder({
"Link-ID",
@@ -66,9 +75,9 @@
@JsonProperty("Quality")
private LinkQuality quality;
@JsonProperty("PDCP-Throughput")
- private PDCPThroughput pdcpThroughput;
+ private PdcpThroughput pdcpThroughput;
@JsonProperty("PDCP-Packet-Delay")
- private PDCPPacketDelay pdcpPackDelay;
+ private PdcpPacketdelay pdcpPackDelay;
@JsonProperty("Resource-Usage")
private ResourceUsage resourceUsage;
@JsonProperty("Type")
@@ -97,6 +106,11 @@
rrmParameters.setEcgi(linkId.getEcgi());
}
+ /**
+ * Get timer.
+ *
+ * @return Timer
+ */
public Timer getTimer() {
return timer;
}
@@ -107,201 +121,270 @@
this.timer = timer;
}
+ /**
+ * Get Link ID.
+ * @return LinkID
+ */
@JsonProperty("Link-ID")
public LinkId getLinkId() {
return linkId;
}
+ /**
+ * Set the Link ID.
+ * @param linkId Link ID
+ */
@JsonProperty("Link-ID")
public void setLinkId(LinkId linkId) {
this.linkId = linkId;
}
+ /**
+ * Set the LINK ID with cell and ue.
+ * @param cell Rnib CELL
+ * @param ue Rnib UE
+ */
public void setLinkId(RnibCell cell, RnibUe ue) {
this.linkId = LinkId.valueOf(cell, ue);
trafficPercent.setEcgi(cell.getEcgi());
}
+ /**
+ * Get the link type.
+ *
+ * @return Link-type
+ */
@JsonProperty("Type")
public Type getType() {
return type;
}
+ /**
+ * Set the link type.
+ * @param type Link-type
+ */
@JsonProperty("Type")
public void setType(Type type) {
this.type = type;
}
+ /**
+ * Get traffic percent.
+ * @return TrafficSplitPercentage
+ */
@JsonProperty("TrafficPercent")
public TrafficSplitPercentage getTrafficPercent() {
return trafficPercent;
}
+ /**
+ * Set traffic percent.
+ * @param trafficPercent TrafficSplitPercentage
+ */
@JsonProperty("TrafficPercent")
public void setTrafficPercent(TrafficSplitPercentage trafficPercent) {
this.trafficPercent = trafficPercent;
}
+ /**
+ * Get the Bearer Parameters.
+ * @return ERABParams
+ */
@JsonProperty("BearerParameters")
public ERABParams getBearerParameters() {
return bearerParameters;
}
+ /**
+ * Set the Bearer Parameters.
+ * @param bearerParameters ERABParams
+ */
@JsonProperty("BearerParameters")
public void setBearerParameters(ERABParams bearerParameters) {
this.bearerParameters = bearerParameters;
}
+ /**
+ * Get Quality.
+ * @return LinkQuality
+ */
@JsonProperty("Quality")
public LinkQuality getQuality() {
return quality;
}
+ /**
+ * Set Quality.
+ * @param quality LinkQuality
+ */
@JsonProperty("Quality")
public void setQuality(LinkQuality quality) {
this.quality = quality;
}
+ /**
+ * Get RRM Configuration.
+ * @return RRMConfig
+ */
@JsonProperty("RRMConfiguration")
public RRMConfig getRrmParameters() {
return rrmParameters;
}
+ /**
+ * Set RRM Configuration.
+ * @param rrmParameters RRMConfig
+ */
@JsonProperty("RRMConfiguration")
public void setRrmParameters(RRMConfig rrmParameters) {
this.rrmParameters = rrmParameters;
}
+ /**
+ * Modify the RRM Config parameters of link.
+ *
+ * @param rrmConfigNode RRMConfig parameters to modify obtained from REST call
+ */
public void modifyRrmParameters(JsonNode rrmConfigNode) {
- {
- JsonNode p_a = rrmConfigNode.path("p_a");
- if (!p_a.isMissingNode()) {
- RRMConfig.Pa pa = new RRMConfig.Pa();
- List<XICICPA> collect = Lists.newArrayList();
- collect.add(new XICICPA(p_a.asInt()));
- pa.setXICICPA(collect);
- rrmParameters.setPa(pa);
- }
+ JsonNode pA = rrmConfigNode.path("p_a");
+ if (!pA.isMissingNode()) {
+ RRMConfig.Pa pa = new RRMConfig.Pa();
+
+ List<XICICPA> collect = Lists.newArrayList();
+ collect.add(new XICICPA(pA.asInt()));
+ pa.setXICICPA(collect);
+ rrmParameters.setPa(pa);
}
- {
- JsonNode start_prb_dl = rrmConfigNode.path("start_prb_dl");
- if (!start_prb_dl.isMissingNode()) {
- RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
+ JsonNode startPrbDl1 = rrmConfigNode.path("start_prb_dl");
+ if (!startPrbDl1.isMissingNode()) {
+ RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
- List<BerInteger> collect = Lists.newArrayList();
- collect.add(new BerInteger(start_prb_dl.asInt()));
- startPrbDl.setSeqOf(collect);
+ List<BerInteger> collect = Lists.newArrayList();
+ collect.add(new BerInteger(startPrbDl1.asInt()));
+ startPrbDl.setSeqOf(collect);
- rrmParameters.setStartPrbDl(startPrbDl);
- }
+ rrmParameters.setStartPrbDl(startPrbDl);
}
- {
- JsonNode end_prb_dl = rrmConfigNode.path("end_prb_dl");
- if (!end_prb_dl.isMissingNode()) {
- RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
+ JsonNode endPrbDl1 = rrmConfigNode.path("end_prb_dl");
+ if (!endPrbDl1.isMissingNode()) {
+ RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
- List<BerInteger> collect = Lists.newArrayList();
- collect.add(new BerInteger(end_prb_dl.asInt()));
- endPrbDl.setSeqOf(collect);
+ List<BerInteger> collect = Lists.newArrayList();
+ collect.add(new BerInteger(endPrbDl1.asInt()));
+ endPrbDl.setSeqOf(collect);
- rrmParameters.setEndPrbDl(endPrbDl);
- }
+ rrmParameters.setEndPrbDl(endPrbDl);
}
- {
- JsonNode sub_frame_bitmask_dl = rrmConfigNode.path("sub_frame_bitmask_dl");
- if (!sub_frame_bitmask_dl.isMissingNode()) {
- RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl();
- List<BerBitString> collect = Lists.newArrayList();
-
- byte[] hexString = DatatypeConverter.parseHexBinary(sub_frame_bitmask_dl.asText());
- collect.add(new BerBitString(hexString, 10));
- subframeBitmaskDl.setSeqOf(collect);
- rrmParameters.setSubframeBitmaskDl(subframeBitmaskDl);
- }
+ JsonNode subFrameBitmaskDl = rrmConfigNode.path("sub_frame_bitmask_dl");
+ if (!subFrameBitmaskDl.isMissingNode()) {
+ RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl();
+ List<BerBitString> collect = Lists.newArrayList();
+
+ byte[] hexString = DatatypeConverter.parseHexBinary(subFrameBitmaskDl.asText());
+ collect.add(new BerBitString(hexString, 10));
+ subframeBitmaskDl.setSeqOf(collect);
+ rrmParameters.setSubframeBitmaskDl(subframeBitmaskDl);
}
- {
- JsonNode start_prb_ul = rrmConfigNode.path("start_prb_ul");
- if (!start_prb_ul.isMissingNode()) {
- RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl();
+ JsonNode startPrbUl1 = rrmConfigNode.path("start_prb_ul");
+ if (!startPrbUl1.isMissingNode()) {
+ RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl();
- List<BerInteger> collect = Lists.newArrayList();
- collect.add(new BerInteger(start_prb_ul.asInt()));
- startPrbUl.setSeqOf(collect);
+ List<BerInteger> collect = Lists.newArrayList();
+ collect.add(new BerInteger(startPrbUl1.asInt()));
+ startPrbUl.setSeqOf(collect);
- rrmParameters.setStartPrbUl(startPrbUl);
- }
+ rrmParameters.setStartPrbUl(startPrbUl);
}
- {
- JsonNode end_prb_ul = rrmConfigNode.path("end_prb_ul");
- if (!end_prb_ul.isMissingNode()) {
- RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl();
+ JsonNode endPrbUl1 = rrmConfigNode.path("end_prb_ul");
+ if (!endPrbUl1.isMissingNode()) {
+ RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl();
- List<BerInteger> collect = Lists.newArrayList();
- collect.add(new BerInteger(end_prb_ul.asInt()));
- endPrbUl.setSeqOf(collect);
+ List<BerInteger> collect = Lists.newArrayList();
+ collect.add(new BerInteger(endPrbUl1.asInt()));
+ endPrbUl.setSeqOf(collect);
- rrmParameters.setEndPrbUl(endPrbUl);
- }
+ rrmParameters.setEndPrbUl(endPrbUl);
}
- {
- JsonNode p0_ue_pusch = rrmConfigNode.path("p0_ue_pusch");
- if (!p0_ue_pusch.isMissingNode()) {
- RRMConfig.P0UePusch p0UePusch = new RRMConfig.P0UePusch();
- List<BerInteger> collect = Lists.newArrayList();
- collect.add(new BerInteger(p0_ue_pusch.asInt()));
- p0UePusch.setSeqOf(collect);
+ JsonNode p0UePusch1 = rrmConfigNode.path("p0_ue_pusch");
+ if (!p0UePusch1.isMissingNode()) {
+ RRMConfig.P0UePusch p0UePusch = new RRMConfig.P0UePusch();
- rrmParameters.setP0UePusch(p0UePusch);
- }
+ List<BerInteger> collect = Lists.newArrayList();
+ collect.add(new BerInteger(p0UePusch1.asInt()));
+ p0UePusch.setSeqOf(collect);
+
+ rrmParameters.setP0UePusch(p0UePusch);
}
- {
- JsonNode sub_frame_bitmask_ul = rrmConfigNode.path("sub_frame_bitmask_ul");
- if (!sub_frame_bitmask_ul.isMissingNode()) {
- RRMConfig.SubframeBitmaskUl subframeBitmaskUl = new RRMConfig.SubframeBitmaskUl();
- List<BerBitString> collect = Lists.newArrayList();
+ JsonNode subFrameBitmaskUl = rrmConfigNode.path("sub_frame_bitmask_ul");
+ if (!subFrameBitmaskUl.isMissingNode()) {
+ RRMConfig.SubframeBitmaskUl subframeBitmaskUl = new RRMConfig.SubframeBitmaskUl();
+ List<BerBitString> collect = Lists.newArrayList();
- byte[] hexString = DatatypeConverter.parseHexBinary(sub_frame_bitmask_ul.asText());
- collect.add(new BerBitString(hexString, 10));
- subframeBitmaskUl.setSeqOf(collect);
- rrmParameters.setSubframeBitmaskUl(subframeBitmaskUl);
- }
+ byte[] hexString = DatatypeConverter.parseHexBinary(subFrameBitmaskUl.asText());
+ collect.add(new BerBitString(hexString, 10));
+ subframeBitmaskUl.setSeqOf(collect);
+ rrmParameters.setSubframeBitmaskUl(subframeBitmaskUl);
}
}
+ /**
+ * Get PDCP Throughput.
+ * @return PdcpThroughput
+ */
@JsonProperty("PDCP-Throughput")
- public PDCPThroughput getPdcpThroughput() {
+ public PdcpThroughput getPdcpThroughput() {
return pdcpThroughput;
}
+ /**
+ * Set PDCP Throughput.
+ * @param pdcpThroughput PdcpThroughput
+ */
@JsonProperty("PDCP-Throughput")
- public void setPdcpThroughput(PDCPThroughput pdcpThroughput) {
+ public void setPdcpThroughput(PdcpThroughput pdcpThroughput) {
this.pdcpThroughput = pdcpThroughput;
}
+ /**
+ * Get PdcpPackDelay.
+ * @return PdcpPacketdelay
+ */
@JsonProperty("PDCP-Packet-Delay")
- public PDCPPacketDelay getPdcpPackDelay() {
+ public PdcpPacketdelay getPdcpPackDelay() {
return pdcpPackDelay;
}
+ /**
+ * Set PdcpPackDelay.
+ * @param pdcpPackDelay PdcpPacketdelay
+ */
@JsonProperty("PDCP-Packet-Delay")
- public void setPdcpPackDelay(PDCPPacketDelay pdcpPackDelay) {
+ public void setPdcpPackDelay(PdcpPacketdelay pdcpPackDelay) {
this.pdcpPackDelay = pdcpPackDelay;
}
+ /**
+ * Get ResourceUsage.
+ * @return ResourceUsage
+ */
@JsonProperty("Resource-Usage")
public ResourceUsage getResourceUsage() {
return resourceUsage;
}
+ /**
+ * Set ResourceUsage.
+ * @param resourceUsage ResourceUsage
+ */
@JsonProperty("Resource-Usage")
public void setResourceUsage(ResourceUsage resourceUsage) {
this.resourceUsage = resourceUsage;
@@ -325,8 +408,12 @@
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
RnibLink link = (RnibLink) o;
@@ -338,30 +425,32 @@
return linkId.hashCode();
}
+ /**
+ * Enum of Link-Type.
+ */
public enum Type {
SERVING_PRIMARY("serving/primary") {
@Override
public String toString() {
- return "\"serving/primary\"";
+ return "serving/primary";
}
},
- // TODO: Add CA/DC
SERVING_SECONDARY_CA("serving/secondary/ca") {
@Override
public String toString() {
- return "\"serving/secondary/ca\"";
+ return "serving/secondary/ca";
}
},
SERVING_SECONDARY_DC("serving/secondary/dc") {
@Override
public String toString() {
- return "\"serving/secondary/dc\"";
+ return "serving/secondary/dc";
}
},
NON_SERVING("non-serving") {
@Override
public String toString() {
- return "\"non-serving\"";
+ return "non-serving";
}
};
@@ -371,6 +460,11 @@
this.name = name;
}
+ /**
+ * Get enum value of link-type.
+ * @param name String representation of Enum Type
+ * @return Type
+ */
public static Type getEnum(String name) {
Optional<Type> any = Arrays.stream(Type.values()).filter(typeStr -> typeStr.name.equals(name)).findAny();
if (any.isPresent()) {
@@ -380,153 +474,247 @@
}
}
+ /**
+ * Quality of Link.
+ */
@JsonPropertyOrder({
- "RX",
- "CQI",
- "MCS"
+ "rx",
+ "cqi",
+ "mcs"
})
@JsonIgnoreProperties(ignoreUnknown = true)
public static class LinkQuality {
- RX RX = null;
- CQI CQI = null;
- MCS MCS = null;
+ Rx rx = null;
+ Cqi cqi = null;
+ Mcs mcs = null;
- public LinkQuality.RX getRX() {
- return RX;
+ /**
+ * Get rx.
+ * @return rx
+ */
+ public Rx getRx() {
+ return rx;
}
- public void setRX(LinkQuality.RX RX) {
- this.RX = RX;
+ /**
+ * Set rx.
+ * @param rx rx
+ */
+ public void setRx(Rx rx) {
+ this.rx = rx;
}
- public LinkQuality.CQI getCQI() {
- return CQI;
+ /**
+ * Get cqi.
+ * @return cqi
+ */
+ public Cqi getCqi() {
+ return cqi;
}
- public void setCQI(LinkQuality.CQI CQI) {
- this.CQI = CQI;
+ /**
+ * Set cqi.
+ * @param cqi cqi
+ */
+ public void setCqi(Cqi cqi) {
+ this.cqi = cqi;
}
- public LinkQuality.MCS getMCS() {
- return MCS;
+ /**
+ * Get mcs.
+ * @return mcs
+ */
+ public Mcs getMcs() {
+ return mcs;
}
- public void setMCS(LinkQuality.MCS MCS) {
- this.MCS = MCS;
+ /**
+ * Set mcs.
+ * @param mcs mcs
+ */
+ public void setMcs(Mcs mcs) {
+ this.mcs = mcs;
}
+ /**
+ * Class to represent rx.
+ */
@JsonPropertyOrder({
- "RSRP",
- "RSRQ",
+ "rsrp",
+ "rsrq",
"timesincelastupdate"
})
@JsonIgnoreProperties(ignoreUnknown = true)
- public static class RX {
- double RSRP;
- double RSRQ;
+ public static class Rx {
+ double rsrp;
+ double rsrq;
WallClockTimestamp timesincelastupdate;
@JsonCreator
- public RX(@JsonProperty("RSRP") double RSRP, @JsonProperty("RSRQ") double RSRQ) {
- this.RSRP = RSRP;
- this.RSRQ = RSRQ;
+ public Rx(@JsonProperty("rsrp") double rsrp, @JsonProperty("rsrq") double rsrq) {
+ this.rsrp = rsrp;
+ this.rsrq = rsrq;
this.timesincelastupdate = new WallClockTimestamp();
}
- public double getRSRP() {
- return RSRP;
+ /**
+ * Get rsrp.
+ * @return double rsrp
+ */
+ public double getRsrp() {
+ return rsrp;
}
- public void setRSRP(double RSRP) {
- this.RSRP = RSRP;
+ /**
+ * Set rsrp.
+ * @param rsrp rsrp
+ */
+ public void setRsrp(double rsrp) {
+ this.rsrp = rsrp;
}
- public double getRSRQ() {
- return RSRQ;
+ /**
+ * Get rsrq.
+ * @return double rsrq
+ */
+ public double getRsrq() {
+ return rsrq;
}
- public void setRSRQ(double RSRQ) {
- this.RSRQ = RSRQ;
+ /**
+ * Set rsrq.
+ * @param rsrq rsrq
+ */
+ public void setRsrq(double rsrq) {
+ this.rsrq = rsrq;
}
+ /**
+ * Get time since last update.
+ *
+ * @return long Time
+ */
public long getTimesincelastupdate() {
return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
}
+ /**
+ * Set time since last update.
+ *
+ * @param timesincelastupdate time since last update
+ */
public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
this.timesincelastupdate = timesincelastupdate;
}
@Override
public String toString() {
- return "RX{" +
- "RSRP=" + RSRP +
- ", RSRQ=" + RSRQ +
- ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+ return "rx{" +
+ "rsrp=" + rsrp +
+ ", rsrq=" + rsrq +
+ ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+ timesincelastupdate.unixTimestamp()) +
'}';
}
}
@JsonPropertyOrder({
- "Hist",
- "Mode",
- "Mean",
+ "hist",
+ "mode",
+ "mean",
"timesincelastupdate"
})
@JsonIgnoreProperties(ignoreUnknown = true)
- public static class CQI {
- RadioRepPerServCell.CqiHist Hist;
- double Mode;
- double Mean;
+ public static class Cqi {
+ RadioRepPerServCell.CqiHist hist;
+ double mode;
+ double mean;
WallClockTimestamp timesincelastupdate;
@JsonCreator
- public CQI(@JsonProperty("Hist") RadioRepPerServCell.CqiHist hist, @JsonProperty("Mode") double mode, @JsonProperty("Mean") double mean) {
- Hist = hist;
- Mode = mode;
- Mean = mean;
+ public Cqi(@JsonProperty("hist") RadioRepPerServCell.CqiHist hist, @JsonProperty("mode") double mode,
+ @JsonProperty("mean") double mean) {
+ this.hist = hist;
+ this.mode = mode;
+ this.mean = mean;
this.timesincelastupdate = new WallClockTimestamp();
}
+
+ /**
+ * Get CQIHist.
+ * @return CqiHist
+ */
public RadioRepPerServCell.CqiHist getHist() {
- return Hist;
+ return hist;
}
+ /**
+ * Get CQIHist.
+ * @param hist CqiHist
+ */
public void setHist(RadioRepPerServCell.CqiHist hist) {
- Hist = hist;
+ this.hist = hist;
}
+ /**
+ * Get mode.
+ * @return double mode
+ */
public double getMode() {
- return Mode;
+ return mode;
}
+ /**
+ * Set mode.
+ * @param mode mode
+ */
public void setMode(double mode) {
- Mode = mode;
+ this.mode = mode;
}
+ /**
+ * Get mean.
+ * @return double mean
+ */
public double getMean() {
- return Mean;
+ return mean;
}
+ /**
+ * Set mean.
+ * @param mean mean
+ */
public void setMean(double mean) {
- Mean = mean;
+ this.mean = mean;
}
+ /**
+ * Get time since last update.
+ *
+ * @return long Time
+ */
public long getTimesincelastupdate() {
return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
}
+ /**
+ * Set time since last update.
+ *
+ * @param timesincelastupdate time since last update
+ */
public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
this.timesincelastupdate = timesincelastupdate;
}
@Override
public String toString() {
- return "CQI{" +
- "Hist=" + Hist +
- ", Mode=" + Mode +
- ", Mean=" + Mean +
- ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+ return "cqi{" +
+ "hist=" + hist +
+ ", mode=" + mode +
+ ", mean=" + mean +
+ ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+ timesincelastupdate.unixTimestamp()) +
'}';
}
}
@@ -537,48 +725,76 @@
"timesincelastupdate"
})
@JsonIgnoreProperties(ignoreUnknown = true)
- public static class MCS {
+ public static class Mcs {
SchedMeasRepPerServCell.McsDl dl;
SchedMeasRepPerServCell.McsUl ul;
WallClockTimestamp timesincelastupdate;
@JsonCreator
- public MCS(@JsonProperty("dl") SchedMeasRepPerServCell.McsDl dl, @JsonProperty("ul") SchedMeasRepPerServCell.McsUl ul) {
+ public Mcs(@JsonProperty("dl") SchedMeasRepPerServCell.McsDl dl,
+ @JsonProperty("ul") SchedMeasRepPerServCell.McsUl ul) {
this.dl = dl;
this.ul = ul;
this.timesincelastupdate = new WallClockTimestamp();
}
+ /**
+ * Get DL.
+ * @return Dl
+ */
public SchedMeasRepPerServCell.McsDl getDl() {
return dl;
}
+ /**
+ * Set DL.
+ * @param dl DL
+ */
public void setDl(SchedMeasRepPerServCell.McsDl dl) {
this.dl = dl;
}
+ /**
+ * Get UL.
+ * @return Ul
+ */
public SchedMeasRepPerServCell.McsUl getUl() {
return ul;
}
+ /**
+ * Set UL.
+ * @param ul Ul
+ */
public void setUl(SchedMeasRepPerServCell.McsUl ul) {
this.ul = ul;
}
+ /**
+ * Get time since last update.
+ *
+ * @return long Time
+ */
public long getTimesincelastupdate() {
return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
}
+ /**
+ * Set time since last update.
+ *
+ * @param timesincelastupdate time since last update
+ */
public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
this.timesincelastupdate = timesincelastupdate;
}
@Override
public String toString() {
- return "MCS{" +
+ return "mcs{" +
"dl=" + dl +
", ul=" + ul +
- ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+ ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+ timesincelastupdate.unixTimestamp()) +
'}';
}
}
@@ -590,38 +806,65 @@
"ul"
})
@JsonIgnoreProperties(ignoreUnknown = true)
- public static class PDCPThroughput {
+ public static class PdcpThroughput {
WallClockTimestamp timesincelastupdate;
private PDCPMeasReportPerUe.ThroughputDl dl;
private PDCPMeasReportPerUe.ThroughputUl ul;
@JsonCreator
- public PDCPThroughput(@JsonProperty("dl") PDCPMeasReportPerUe.ThroughputDl dl, @JsonProperty("ul") PDCPMeasReportPerUe.ThroughputUl ul) {
+ public PdcpThroughput(@JsonProperty("dl") PDCPMeasReportPerUe.ThroughputDl dl,
+ @JsonProperty("ul") PDCPMeasReportPerUe.ThroughputUl ul) {
this.dl = dl;
this.ul = ul;
this.timesincelastupdate = new WallClockTimestamp();
}
+ /**
+ * Get DL.
+ * @return Dl
+ */
public PDCPMeasReportPerUe.ThroughputDl getDl() {
return dl;
}
+ /**
+ * Set DL.
+ * @param dl DL
+ */
public void setDl(PDCPMeasReportPerUe.ThroughputDl dl) {
this.dl = dl;
}
+ /**
+ * Get UL.
+ * @return Ul
+ */
public PDCPMeasReportPerUe.ThroughputUl getUl() {
return ul;
}
+ /**
+ * Set UL.
+ * @param ul Ul
+ */
public void setUl(PDCPMeasReportPerUe.ThroughputUl ul) {
this.ul = ul;
}
+ /**
+ * Get time since last update.
+ *
+ * @return long Time
+ */
public long getTimesincelastupdate() {
return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
}
+ /**
+ * Set time since last update.
+ *
+ * @param timesincelastupdate time since last update
+ */
public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
this.timesincelastupdate = timesincelastupdate;
}
@@ -629,10 +872,11 @@
@Override
public String
toString() {
- return "PDCPThroughput{" +
+ return "PdcpThroughput{" +
"dl=" + dl +
", ul=" + ul +
- ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+ ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+ timesincelastupdate.unixTimestamp()) +
'}';
}
}
@@ -642,48 +886,76 @@
"ul"
})
@JsonIgnoreProperties(ignoreUnknown = true)
- public static class PDCPPacketDelay {
+ public static class PdcpPacketdelay {
PDCPMeasReportPerUe.PktDelayDl dl;
PDCPMeasReportPerUe.PktDelayUl ul;
WallClockTimestamp timesincelastupdate;
@JsonCreator
- public PDCPPacketDelay(@JsonProperty("dl") PDCPMeasReportPerUe.PktDelayDl dl, @JsonProperty("ul") PDCPMeasReportPerUe.PktDelayUl ul) {
+ public PdcpPacketdelay(@JsonProperty("dl") PDCPMeasReportPerUe.PktDelayDl dl,
+ @JsonProperty("ul") PDCPMeasReportPerUe.PktDelayUl ul) {
this.dl = dl;
this.ul = ul;
this.timesincelastupdate = new WallClockTimestamp();
}
+ /**
+ * Get DL.
+ * @return Dl
+ */
public PDCPMeasReportPerUe.PktDelayDl getDl() {
return dl;
}
+ /**
+ * Set DL.
+ * @param dl DL
+ */
public void setDl(PDCPMeasReportPerUe.PktDelayDl dl) {
this.dl = dl;
}
+ /**
+ * Get UL.
+ * @return Ul
+ */
public PDCPMeasReportPerUe.PktDelayUl getUl() {
return ul;
}
+ /**
+ * Set UL.
+ * @param ul Ul
+ */
public void setUl(PDCPMeasReportPerUe.PktDelayUl ul) {
this.ul = ul;
}
+ /**
+ * Get time since last update.
+ *
+ * @return long Time
+ */
public long getTimesincelastupdate() {
return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
}
+ /**
+ * Set time since last update.
+ *
+ * @param timesincelastupdate time since last update
+ */
public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
this.timesincelastupdate = timesincelastupdate;
}
@Override
public String toString() {
- return "PDCPPacketDelay{" +
+ return "PdcpPacketdelay{" +
"dl=" + dl +
", ul=" + ul +
- ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+ ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+ timesincelastupdate.unixTimestamp()) +
'}';
}
}
@@ -699,32 +971,59 @@
WallClockTimestamp timesincelastupdate;
@JsonCreator
- public ResourceUsage(@JsonProperty("dl") PRBUsage.PrbUsageDl dl, @JsonProperty("ul") PRBUsage.PrbUsageUl ul) {
+ public ResourceUsage(@JsonProperty("dl") PRBUsage.PrbUsageDl dl,
+ @JsonProperty("ul") PRBUsage.PrbUsageUl ul) {
this.dl = dl;
this.ul = ul;
this.timesincelastupdate = new WallClockTimestamp();
}
+ /**
+ * Get DL.
+ * @return Dl
+ */
public PRBUsage.PrbUsageDl getDl() {
return dl;
}
+ /**
+ * Set DL.
+ * @param dl DL
+ */
public void setDl(PRBUsage.PrbUsageDl dl) {
this.dl = dl;
}
+ /**
+ * Get UL.
+ * @return Ul
+ */
public PRBUsage.PrbUsageUl getUl() {
return ul;
}
+ /**
+ * Set UL.
+ * @param ul Ul
+ */
public void setUl(PRBUsage.PrbUsageUl ul) {
this.ul = ul;
}
+ /**
+ * Get time since last update.
+ *
+ * @return long Time
+ */
public long getTimesincelastupdate() {
return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp();
}
+ /**
+ * Set time since last update.
+ *
+ * @param timesincelastupdate time since last update
+ */
public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) {
this.timesincelastupdate = timesincelastupdate;
}
@@ -734,7 +1033,8 @@
return "ResourceUsage{" +
"dl=" + dl +
", ul=" + ul +
- ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) +
+ ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() -
+ timesincelastupdate.unixTimestamp()) +
'}';
}
}
diff --git a/src/main/java/org.onosproject.xran/entities/RnibSlice.java b/src/main/java/org.onosproject.xran/entities/RnibSlice.java
index 92e1d98..33cea1b 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibSlice.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibSlice.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/entities/RnibUe.java b/src/main/java/org.onosproject.xran/entities/RnibUe.java
index 3afcb04..2d6b605 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibUe.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibUe.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@
import static org.onosproject.net.HostId.hostId;
/**
- * Created by dimitris on 7/22/17.
+ * R-NIB UE and its properties.
*/
@JsonPropertyOrder({
"ID",
@@ -82,6 +82,11 @@
timer = new Timer();
}
+ /**
+ * Convert Host ID to UE ID.
+ * @param hostId hostID
+ * @return Long UE ID
+ */
public static Long hostIdtoUEId(HostId hostId) {
String mac = hostId.mac().toString();
mac = mac.replace(":", "");
@@ -89,11 +94,19 @@
return l;
}
+ /**
+ * Get timer.
+ * @return Timer
+ */
@JsonIgnore
public Timer getTimer() {
return timer;
}
+ /**
+ * Set timer.
+ * @param timer Timer
+ */
@JsonIgnore
public void setTimer(Timer timer) {
this.timer.cancel();
@@ -101,46 +114,82 @@
this.timer = timer;
}
+ /**
+ * Get MMEUES1APID.
+ * @return MMEUES1APID
+ */
@JsonProperty("MMEUES1APID")
public MMEUES1APID getMmeS1apId() {
return mmeS1apId;
}
+ /**
+ * Set MMEUES1APID.
+ * @param mmeS1apId MMEUES1APID
+ */
@JsonProperty("MMEUES1APID")
public void setMmeS1apId(MMEUES1APID mmeS1apId) {
this.mmeS1apId = mmeS1apId;
}
+ /**
+ * Get ENBUES1APID.
+ * @return ENBUES1APID
+ */
@JsonProperty("ENBUES1APID")
public ENBUES1APID getEnbS1apId() {
return enbS1apId;
}
+ /**
+ * Set ENBUES1APID.
+ * @param enbS1apId ENBUES1APID
+ */
@JsonProperty("ENBUES1APID")
public void setEnbS1apId(ENBUES1APID enbS1apId) {
this.enbS1apId = enbS1apId;
}
+ /**
+ * Get CRNTI.
+ * @return CRNTI
+ */
@JsonProperty("CRNTI")
public CRNTI getCrnti() {
return crnti;
}
+ /**
+ * Set CRNTI.
+ * @param crnti CRNTI
+ */
@JsonProperty("CRNTI")
public void setCrnti(CRNTI crnti) {
this.crnti = crnti;
}
+ /**
+ * Get IMSI.
+ * @return IMSI
+ */
@JsonProperty("IMSI")
public String getImsi() {
return imsi;
}
+ /**
+ * Set IMSI.
+ * @param imsi IMSI
+ */
@JsonProperty("IMSI")
public void setImsi(String imsi) {
this.imsi = imsi;
}
+ /**
+ * Get Host ID.
+ * @return HostId
+ */
@JsonIgnore
public HostId getHostId() {
try {
@@ -180,40 +229,72 @@
return null;
}
+ /**
+ * Get RXMeasConfig Report.
+ * @return RXSigMeasConfig
+ */
@JsonProperty("MeasurementConfiguration")
public RXSigMeasConfig getMeasConfig() {
return measConfig;
}
+ /**
+ * Set RXMeasConfig Report.
+ * @param measConfig RXSigMeasConfig
+ */
@JsonProperty("MeasurementConfiguration")
public void setMeasConfig(RXSigMeasConfig measConfig) {
this.measConfig = measConfig;
}
+ /**
+ * Get UE Capability Info.
+ * @return UECapabilityInfo
+ */
@JsonProperty("Capability")
public UECapabilityInfo getCapability() {
return capability;
}
+ /**
+ * Set UE Capability Info.
+ * @param capability UECapabilityInfo
+ */
@JsonProperty("Capability")
public void setCapability(UECapabilityInfo capability) {
this.capability = capability;
}
+ /**
+ * Get State.
+ * @return State
+ */
@JsonProperty("State")
public State getState() {
return state;
}
+ /**
+ * Set State.
+ * @param state State
+ */
@JsonProperty("State")
public void setState(State state) {
this.state = state;
}
+ /**
+ * Get UE ID.
+ * @return Long UE ID
+ */
public Long getId() {
return id;
}
+ /**
+ * Set UE ID.
+ * @param id Long UE ID
+ */
public void setId(Long id) {
this.id = id;
}
@@ -232,30 +313,48 @@
'}';
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals()
+ */
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
RnibUe rnibUe = (RnibUe) o;
return Objects.equals(id, rnibUe.id);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
@Override
public int hashCode() {
return Objects.hash(id);
}
+
+ /**
+ * Enum of State of UE.
+ */
public enum State {
ACTIVE {
@Override
public String toString() {
- return "\"ACTIVE\"";
+ return "ACTIVE";
}
},
IDLE {
@Override
public String toString() {
- return "\"IDLE\"";
+ return "IDLE";
}
}
}
diff --git a/src/main/java/org.onosproject.xran/entities/package-info.java b/src/main/java/org.onosproject.xran/entities/package-info.java
index 6b2c4c4..be85174 100644
--- a/src/main/java/org.onosproject.xran/entities/package-info.java
+++ b/src/main/java/org.onosproject.xran/entities/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java b/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java
index 6347788..f12f62a 100644
--- a/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java
+++ b/src/main/java/org.onosproject.xran/identifiers/EcgiCrntiPair.java
@@ -21,10 +21,13 @@
import org.onosproject.xran.codecs.api.CRNTI;
import org.onosproject.xran.codecs.api.ECGI;
+/**
+ * Class to maintain pair of ECGI and CRNTI.
+ */
public class EcgiCrntiPair extends Pair<ECGI, CRNTI> {
/**
- * Creates a new pair
+ * Creates a new pair.
*
* @param key The key for this pair
* @param value The value to use for this pair
@@ -33,6 +36,13 @@
super(key, value);
}
+ /**
+ * Return a new EcgiCrntiPair.
+ *
+ * @param key ECGI
+ * @param value CRNTI
+ * @return EcgiCrntiPair
+ */
public static EcgiCrntiPair valueOf(ECGI key, CRNTI value) {
return new EcgiCrntiPair(key, value);
}
diff --git a/src/main/java/org.onosproject.xran/identifiers/LinkId.java b/src/main/java/org.onosproject.xran/identifiers/LinkId.java
index e2b489a..7bb94f7 100644
--- a/src/main/java/org.onosproject.xran/identifiers/LinkId.java
+++ b/src/main/java/org.onosproject.xran/identifiers/LinkId.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,12 +24,15 @@
import org.onosproject.xran.entities.RnibCell;
import org.onosproject.xran.entities.RnibUe;
+/**
+ * Class for LinkId.
+ */
@JsonPropertyOrder({
"ECGI",
"UEID"
})
@JsonIgnoreProperties(ignoreUnknown = true)
-public class LinkId {
+public final class LinkId {
@JsonIgnore
private RnibCell cell;
@JsonIgnore
@@ -40,59 +43,108 @@
this.ue = ue;
}
+ /**
+ * Create new LinkId.
+ * @param cell Cell
+ * @param ue UE
+ * @return new LinkId
+ */
public static LinkId valueOf(RnibCell cell, RnibUe ue) {
return new LinkId(cell, ue);
}
- public static LinkId valueOf(ECGI ecgi, Long UeId) {
+ /**
+ * Create new LinkID with ECGI and UE ID given.
+ * @param ecgi ECGI of new cell
+ * @param ueId UE ID of new UE
+ * @return LinkId
+ */
+ public static LinkId valueOf(ECGI ecgi, Long ueId) {
RnibCell cell = new RnibCell();
RnibUe ue = new RnibUe();
cell.setEcgi(ecgi);
- ue.setId(UeId);
+ ue.setId(ueId);
return new LinkId(cell, ue);
}
+ /**
+ * Get ECGI.
+ * @return ECGI
+ */
@JsonProperty("ECGI")
public ECGI getEcgi() {
return cell.getEcgi();
}
+ /**
+ * Set ECGI.
+ * @param sourceId ECGI
+ */
@JsonProperty("ECGI")
public void setEcgi(ECGI sourceId) {
cell.setEcgi(sourceId);
}
+ /**
+ * Get UE ID.
+ * @return long UE ID
+ */
@JsonProperty("UEID")
public Long getUeId() {
return ue.getId();
}
+ /**
+ * Set UE ID.
+ * @param destinationId long UE ID
+ */
@JsonProperty("UEID")
public void setUeId(Long destinationId) {
ue.setId(destinationId);
}
+ /**
+ * Get Cell.
+ * @return Cell
+ */
@JsonIgnore
public RnibCell getCell() {
return cell;
}
+ /**
+ * Set Cell.
+ * @param cell Cell
+ */
@JsonIgnore
public void setCell(RnibCell cell) {
this.cell = cell;
}
+ /**
+ * Get UE.
+ * @return UE
+ */
@JsonIgnore
public RnibUe getUe() {
return ue;
}
+ /**
+ * Set UE.
+ * @param ue UE
+ */
@JsonIgnore
public void setUe(RnibUe ue) {
this.ue = ue;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals()
+ */
@Override
public boolean equals(Object o) {
return this == o ||
@@ -103,6 +155,11 @@
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
@Override
public int hashCode() {
int result = cell.getEcgi().hashCode();
diff --git a/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java b/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java
index 82fdaed..4372d8b 100644
--- a/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java
+++ b/src/main/java/org.onosproject.xran/identifiers/contextUpdateHandler.java
@@ -20,15 +20,27 @@
import org.onosproject.xran.codecs.pdu.UEAdmissionStatus;
import org.onosproject.xran.codecs.pdu.UEContextUpdate;
-public class contextUpdateHandler {
+/**
+ * Class to handle UE Context Update packet.
+ */
+public class ContextUpdateHandler {
private UEContextUpdate contextUpdate;
private UEAdmissionStatus admissionStatus;
private HOComplete hoComplete;
+ /**
+ * Get Context Update.
+ * @return UEContextUpdate
+ */
public UEContextUpdate getContextUpdate() {
return contextUpdate;
}
+ /**
+ * Set Context Update.
+ * @param contextUpdate UEContextUpdate
+ * @return boolean to check context update was for admissionStatus packet or HOComplete packet
+ */
public boolean setContextUpdate(UEContextUpdate contextUpdate) {
this.contextUpdate = contextUpdate;
@@ -36,20 +48,38 @@
}
+ /**
+ * Get UEAdmissionStatus.
+ * @return UEAdmissionStatus
+ */
public UEAdmissionStatus getAdmissionStatus() {
return admissionStatus;
}
+ /**
+ * Set UEAdmissionStatus.
+ * @param admissionStatus UEAdmissionStatus
+ * @return boolean contextUpdate exists or not
+ */
public boolean setAdmissionStatus(UEAdmissionStatus admissionStatus) {
this.admissionStatus = admissionStatus;
return contextUpdate != null;
}
+ /**
+ * Get HOComplete.
+ * @return HOComplete
+ */
public HOComplete getHoComplete() {
return hoComplete;
}
+ /**
+ * Set HOComplete.
+ * @param hoComplete HOComplete
+ * @return boolean contextUpdate exists or not
+ */
public boolean setHoComplete(HOComplete hoComplete) {
this.hoComplete = hoComplete;
@@ -58,7 +88,7 @@
@Override
public String toString() {
- return "contextUpdateHandler{" +
+ return "ContextUpdateHandler{" +
"contextUpdate=" + (contextUpdate != null) +
", admissionStatus=" + (admissionStatus != null) +
", hoComplete=" + (hoComplete != null) +
diff --git a/src/main/java/org.onosproject.xran/identifiers/package-info.java b/src/main/java/org.onosproject.xran/identifiers/package-info.java
index 421cee2..d375057 100644
--- a/src/main/java/org.onosproject.xran/identifiers/package-info.java
+++ b/src/main/java/org.onosproject.xran/identifiers/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java b/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java
index 19e50ab..9a1a259 100644
--- a/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java
+++ b/src/main/java/org.onosproject.xran/impl/DefaultXranStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,12 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
-import org.apache.felix.scr.annotations.*;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.core.IdGenerator;
@@ -45,7 +50,7 @@
import static org.slf4j.LoggerFactory.getLogger;
/**
- * Created by dimitris on 7/22/17.
+ * Default xran store.
*/
@Component(immediate = true)
@Service
@@ -67,6 +72,7 @@
public void activate() {
ApplicationId appId = coreService.getAppId(XRAN_APP_ID);
+ // create ue id generator
ueIdGenerator = coreService.getIdGenerator("xran-ue-id");
log.info("XRAN Default Store Started");
@@ -85,7 +91,7 @@
}
@Override
- public List<RnibLink> getLinksByECGI(ECGI ecgi) {
+ public List<RnibLink> getlinksbyecgi(ECGI ecgi) {
List<RnibLink> list = Lists.newArrayList();
list.addAll(
linkMap.keySet()
@@ -98,9 +104,9 @@
}
@Override
- public List<RnibLink> getLinksByCellId(String eciHex) {
+ public List<RnibLink> getlinksbycellid(String eciHex) {
List<RnibLink> list = Lists.newArrayList();
- EUTRANCellIdentifier eci = hexToECI(eciHex);
+ EUTRANCellIdentifier eci = hexToEci(eciHex);
list.addAll(
linkMap.keySet()
@@ -113,7 +119,7 @@
}
@Override
- public List<RnibLink> getLinksByUeId(long euId) {
+ public List<RnibLink> getlinksbyueid(long euId) {
List<RnibLink> list = Lists.newArrayList();
list.addAll(
@@ -128,13 +134,13 @@
@Override
- public RnibLink getLinkBetweenCellIdUeId(String eciHex, long euId) {
- EUTRANCellIdentifier eci = hexToECI(eciHex);
+ public RnibLink getlinkbetweencellidueid(String eciHex, long euId) {
+ EUTRANCellIdentifier eci = hexToEci(eciHex);
Optional<LinkId> first = linkMap.keySet()
.stream()
- .filter(linkId -> linkId.getEcgi().getEUTRANcellIdentifier().equals(eci))
- .filter(linkId -> linkId.getUeId().equals(euId))
+ .filter(linkId -> linkId.getEcgi().getEUTRANcellIdentifier().equals(eci) &&
+ linkId.getUeId().equals(euId))
.findFirst();
return first.map(linkId -> linkMap.get(linkId)).orElse(null);
@@ -147,12 +153,10 @@
// if we add a primary link then change the primary to non serving
if (link.getType().equals(RnibLink.Type.SERVING_PRIMARY)) {
RnibUe ue = link.getLinkId().getUe();
- getLinksByUeId(ue.getId())
- .forEach(l -> {
- if (l.getType().equals(RnibLink.Type.SERVING_PRIMARY)) {
- l.setType(RnibLink.Type.NON_SERVING);
- }
- });
+ getlinksbyueid(ue.getId())
+ .stream()
+ .filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
+ .forEach(l -> l.setType(RnibLink.Type.NON_SERVING));
}
linkMap.put(link.getLinkId(), link);
}
@@ -166,13 +170,12 @@
@Override
public RnibLink getLink(ECGI ecgi, Long ueId) {
-
LinkId linkId = LinkId.valueOf(ecgi, ueId);
return linkMap.get(linkId);
}
@Override
- public void modifyLinkRrmConf(RnibLink link, JsonNode rrmConf) {
+ public void modifylinkrrmconf(RnibLink link, JsonNode rrmConf) {
link.modifyRrmParameters(rrmConf);
}
@@ -185,25 +188,24 @@
}
@Override
- public List<Object> getCellNodes() {
+ public List<Object> getcellnodes() {
List<Object> list = Lists.newArrayList();
list.addAll(cellMap.values());
return list;
}
@Override
- public List<Object> getUeNodes() {
+ public List<Object> getuenodes() {
List<Object> list = Lists.newArrayList();
list.addAll(ueMap.values());
return list;
}
@Override
- public Object getByNodeId(String nodeId) {
+ public Object getbynodeid(String nodeId) {
try {
return getCell(nodeId);
- } catch (Exception e) {
-
+ } catch (Exception ignored) {
}
return getUe(Long.parseLong(nodeId));
}
@@ -222,9 +224,13 @@
@Override
public RnibCell getCell(String hexeci) {
- EUTRANCellIdentifier eci = hexToECI(hexeci);
- Optional<ECGI> first = cellMap.keySet().stream().filter(ecgi -> ecgi.getEUTRANcellIdentifier().equals(eci)).findFirst();
- return first.map(ecgi -> cellMap.get(ecgi)).orElse(null);
+ EUTRANCellIdentifier eci = hexToEci(hexeci);
+ Optional<ECGI> first = cellMap.keySet()
+ .stream()
+ .filter(ecgi -> ecgi.getEUTRANcellIdentifier().equals(eci))
+ .findFirst();
+ return first.map(ecgi -> cellMap.get(ecgi))
+ .orElse(null);
}
@Override
@@ -233,9 +239,11 @@
}
@Override
- public void modifyCellRrmConf(RnibCell cell, JsonNode rrmConf) throws Exception {
- List<RnibLink> linkList = getLinksByECGI(cell.getEcgi());
- List<RnibUe> ueList = linkList.stream().map(link -> link.getLinkId().getUe()).collect(Collectors.toList());
+ public void modifycellrrmconf(RnibCell cell, JsonNode rrmConf) throws Exception {
+ List<RnibLink> linkList = getlinksbyecgi(cell.getEcgi());
+ List<RnibUe> ueList = linkList.stream()
+ .map(link -> link.getLinkId().getUe())
+ .collect(Collectors.toList());
cell.modifyRrmConfig(rrmConf, ueList);
}
@@ -285,7 +293,13 @@
return ueMap.get(ueId);
}
- private EUTRANCellIdentifier hexToECI(String eciHex) {
+ /**
+ * Get from HEX string the according ECI class object.
+ *
+ * @param eciHex HEX string
+ * @return ECI object if created successfully
+ */
+ private EUTRANCellIdentifier hexToEci(String eciHex) {
byte[] hexBinary = DatatypeConverter.parseHexBinary(eciHex);
return new EUTRANCellIdentifier(hexBinary, 28);
}
diff --git a/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java b/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java
index 0e9f3d5..6f3a5dc 100644
--- a/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java
+++ b/src/main/java/org.onosproject.xran/impl/DistributedXranStore.java
@@ -1,5 +1,5 @@
///*
-// * Copyright 2015-present Open Networking Laboratory
+// * Copyright 2015-present Open Networking Foundation
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
@@ -149,7 +149,7 @@
// }
//
// @Override
-// public List<RnibLink> getLinksByCellId(long cellId) {
+// public List<RnibLink> getlinksbycellid(long cellId) {
// List<RnibLink> list = Lists.newArrayList();
// CellId cell = CellId.valueOf(cellId);
// linkMap.keySet().forEach(
@@ -163,7 +163,7 @@
// }
//
// @Override
-// public List<RnibLink> getLinksByUeId(long euId) {
+// public List<RnibLink> getlinksbyueid(long euId) {
// List<RnibLink> list = Lists.newArrayList();
// UeId ue = UeId.valueOf(euId);
// linkMap.keySet().forEach(
@@ -177,7 +177,7 @@
// }
//
// @Override
-// public RnibLink getLinkBetweenCellIdUeId(long cellId, long euId) {
+// public RnibLink getlinkbetweencellidueid(long cellId, long euId) {
// LinkId linkId = LinkId.valueOf(cellId, euId);
// final Versioned<RnibLink> rnibLinkVersioned = linkMap.get(linkId);
// if (rnibLinkVersioned != null) {
@@ -188,7 +188,7 @@
//
// @Override
// public boolean modifyTypeOfLink(long cellId, long euId, String type) {
-// final RnibLink link = getLinkBetweenCellIdUeId(cellId, euId);
+// final RnibLink link = getlinkbetweencellidueid(cellId, euId);
// if (link != null) {
// link.setType(type);
// return true;
@@ -198,7 +198,7 @@
//
// @Override
// public boolean modifyTrafficPercentOfLink(long cellId, long euId, long trafficPercent) {
-// final RnibLink link = getLinkBetweenCellIdUeId(cellId, euId);
+// final RnibLink link = getlinkbetweencellidueid(cellId, euId);
// if (link != null) {
// link.setTrafficPercent(trafficPercent);
// return true;
@@ -232,21 +232,21 @@
// }
//
// @Override
-// public List<RnibCell> getCellNodes() {
+// public List<RnibCell> getcellnodes() {
// List<RnibCell> list = Lists.newArrayList();
// cellMap.values().forEach(v -> list.add(v.value()));
// return list;
// }
//
// @Override
-// public List<RnibUe> getUeNodes() {
+// public List<RnibUe> getuenodes() {
// List<RnibUe> list = Lists.newArrayList();
// ueMap.values().forEach(v -> list.add(v.value()));
// return list;
// }
//
// @Override
-// public Object getByNodeId(long nodeId) {
+// public Object getbynodeid(long nodeId) {
// CellId cellId = CellId.valueOf(nodeId);
// if (cellMap.containsKey(cellId)) {
// return cellMap.get(cellId).value();
@@ -276,7 +276,7 @@
// }
//
// @Override
-// public boolean modifyCellRrmConf(JsonNode rrmConf) {
+// public boolean modifycellrrmconf(JsonNode rrmConf) {
// return false;
// }
//
diff --git a/src/main/java/org.onosproject.xran/impl/XranConfig.java b/src/main/java/org.onosproject.xran/impl/XranConfig.java
index eac3317..e334892 100644
--- a/src/main/java/org.onosproject.xran/impl/XranConfig.java
+++ b/src/main/java/org.onosproject.xran/impl/XranConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.onosproject.xran.impl;
import com.fasterxml.jackson.databind.JsonNode;
+import org.onlab.packet.IpAddress;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.config.Config;
import org.onosproject.xran.codecs.api.ECGI;
@@ -33,6 +34,9 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+/**
+ * Xran config.
+ */
public class XranConfig extends Config<ApplicationId> {
private static final String CELLS = "active_cells";
@@ -63,8 +67,13 @@
private final Logger log = LoggerFactory.getLogger(getClass());
- public Map<String, ECGI> activeCellSet() {
- Map<String, ECGI> cells = new ConcurrentHashMap<>();
+ /**
+ * Get a list of all CELLs inside the configuration file.
+ *
+ * @return Map of CELL IP to ECGI
+ */
+ public Map<IpAddress, ECGI> activeCellSet() {
+ Map<IpAddress, ECGI> cells = new ConcurrentHashMap<>();
JsonNode cellsNode = object.get(CELLS);
if (cellsNode == null) {
@@ -73,58 +82,110 @@
}
cellsNode.forEach(cellNode -> {
- String plmn_id = cellNode.get(PLMN_ID).asText();
+ String plmnId = cellNode.get(PLMN_ID).asText();
String eci = cellNode.get(ECI_ID).asText();
String ipAddress = cellNode.get(IP_ADDR).asText();
- ECGI ecgi = hexToECGI(plmn_id, eci);
- cells.put(ipAddress, ecgi);
+ ECGI ecgi = hexToEcgi(plmnId, eci);
+ cells.put(IpAddress.valueOf(ipAddress), ecgi);
});
return cells;
}
+ /**
+ * Get flag for ADMISSION_SUCCESS field in configuration.
+ *
+ * @return boolean value in configuration
+ */
public boolean admissionFlag() {
JsonNode flag = object.get(ADMISSION_SUCCESS);
return flag != null && flag.asBoolean();
}
+ /**
+ * Get flag for BEARER_SUCCESS field in configuration.
+ *
+ * @return boolean value in configuration
+ */
public boolean bearerFlag() {
JsonNode flag = object.get(BEARER_SUCCESS);
return flag != null && flag.asBoolean();
}
+ /**
+ * Get port for xRAN controller server to bind to from configuration.
+ *
+ * @return port number
+ */
public int getXrancPort() {
return object.get(XRANC_PORT).asInt();
}
+ /**
+ * Get config request interval from configuration.
+ *
+ * @return interval in seconds
+ */
public int getConfigRequestInterval() {
return object.get(XRANC_CELLCONFIG_INTERVAL).asInt();
}
+ /**
+ * Get rx signal interval from configuration.
+ *
+ * @return interval in milliseconds
+ */
public int getRxSignalInterval() {
return object.get(RX_SIGNAL_MEAS_REPORT_INTERVAL).asInt();
}
+ /**
+ * Get l2 measurement interval from configuration.
+ *
+ * @return interval in milliseconds
+ */
public int getL2MeasInterval() {
return object.get(L2_MEAS_REPORT_INTERVAL).asInt();
}
+ /**
+ * Get removal time of link after not getting measurement from configuration.
+ *
+ * @return interval in milliseconds
+ */
public int getNoMeasLinkRemoval() {
return object.get(NO_MEAS_LINK_REMOVAL).asInt();
}
+ /**
+ * Get removal time of UE after being IDLE from configuration.
+ *
+ * @return interval in milliseconds
+ */
public int getIdleUeRemoval() {
return object.get(IDLE_UE_REMOVAL).asInt();
}
+ /**
+ * Get northbound timeout when waiting for responses from configuration.
+ *
+ * @return interval in milliseconds
+ */
public int getNorthBoundTimeout() {
return object.get(NORTHBOUND_TIMEOUT).asInt();
}
- private ECGI hexToECGI(String plmn_id, String eci) {
- byte[] bytes = HexConverter.fromShortHexString(plmn_id);
+ /**
+ * Get ECGI from HEX representation of PLMN_ID and ECI.
+ *
+ * @param plmnId HEX string of PLMN_ID
+ * @param eci HEX string of ECI
+ * @return new ECGI object
+ */
+ private ECGI hexToEcgi(String plmnId, String eci) {
+ byte[] bytes = HexConverter.fromShortHexString(plmnId);
byte[] bytearray = DatatypeConverter.parseHexBinary(eci);
InputStream inputStream = new ByteArrayInputStream(bytearray);
diff --git a/src/main/java/org.onosproject.xran/impl/package-info.java b/src/main/java/org.onosproject.xran/impl/package-info.java
index baf9a19..83cd67e 100644
--- a/src/main/java/org.onosproject.xran/impl/package-info.java
+++ b/src/main/java/org.onosproject.xran/impl/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/package-info.java b/src/main/java/org.onosproject.xran/package-info.java
index 55d9357..2cb39bf 100644
--- a/src/main/java/org.onosproject.xran/package-info.java
+++ b/src/main/java/org.onosproject.xran/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,6 @@
*/
/**
- * VTN web that used rest to creat vtn resources.
+ * Created by dimitris on 7/20/17.
*/
package org.onosproject.xran;
diff --git a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
index af2a24a..a0a5809 100644
--- a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +16,24 @@
package org.onosproject.xran.providers;
-import org.apache.felix.scr.annotations.*;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.ChassisId;
-import org.onosproject.net.*;
-import org.onosproject.net.device.*;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceProvider;
+import org.onosproject.net.device.DeviceProviderRegistry;
+import org.onosproject.net.device.DeviceProviderService;
import org.onosproject.net.provider.AbstractProvider;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.xran.controller.XranController;
@@ -27,14 +41,12 @@
import org.slf4j.Logger;
import static org.onosproject.net.DeviceId.deviceId;
-import static org.onosproject.xran.entities.RnibCell.*;
+import static org.onosproject.xran.entities.RnibCell.uri;
import static org.slf4j.LoggerFactory.getLogger;
-
/**
- * Created by dimitris on 7/27/17.
+ * Cell device provider.
*/
-
@Component(immediate = true)
public class CellDeviceProvider extends AbstractProvider implements DeviceProvider {
@@ -87,6 +99,9 @@
}
+ /**
+ * Internal device listener.
+ */
private class InternalDeviceListener implements XranDeviceListener {
@Override
@@ -95,6 +110,7 @@
return;
}
+ // use ECGI as device ID URI
DeviceId id = deviceId(uri(cell.getEcgi()));
ChassisId cId = new ChassisId(id.hashCode());
diff --git a/src/main/java/org.onosproject.xran/providers/UeProvider.java b/src/main/java/org.onosproject.xran/providers/UeProvider.java
index 435c78a..e84deb2 100644
--- a/src/main/java/org.onosproject.xran/providers/UeProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/UeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,19 @@
package org.onosproject.xran.providers;
import com.google.common.collect.Sets;
-import org.apache.felix.scr.annotations.*;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.VlanId;
-import org.onosproject.net.*;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Host;
+import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
import org.onosproject.net.host.DefaultHostDescription;
import org.onosproject.net.host.HostProvider;
import org.onosproject.net.host.HostProviderRegistry;
@@ -33,14 +43,13 @@
import java.util.Set;
-import static org.onosproject.net.DeviceId.*;
-import static org.onosproject.xran.entities.RnibCell.*;
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.xran.entities.RnibCell.uri;
import static org.slf4j.LoggerFactory.getLogger;
/**
- * Created by dimitris on 7/28/17.
+ * UE Provider.
*/
-
@Component(immediate = true)
public class UeProvider extends AbstractProvider implements HostProvider {
@@ -78,6 +87,9 @@
}
+ /**
+ * Internal host listener.
+ */
class InternalHostListener implements XranHostListener {
@Override
@@ -94,12 +106,15 @@
try {
Set<HostLocation> hostLocations = Sets.newConcurrentHashSet();
- ecgiSet.forEach(ecgi -> hostLocations.add(new HostLocation(deviceId(uri(ecgi)), PortNumber.portNumber(0), 0)));
+ ecgiSet.forEach(ecgi -> hostLocations
+ .add(new HostLocation(deviceId(uri(ecgi)),
+ PortNumber.portNumber(0), 0)));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set(AnnotationKeys.NAME, "UE " + ue.getId())
.build();
+ // Host ID is calculated from UE ID with some hacky function to represent a MAC address.
DefaultHostDescription desc = new DefaultHostDescription(
ue.getHostId().mac(),
VlanId.vlanId(VlanId.UNTAGGED),
diff --git a/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
index 01f0e95..10da57e 100644
--- a/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
+++ b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,21 @@
import org.onosproject.xran.entities.RnibCell;
/**
- * Created by dimitris on 7/27/17.
+ * Xran Device Listener.
*/
public interface XranDeviceListener {
+ /**
+ * Add new CELL as a device.
+ *
+ * @param id CELL entity
+ */
void deviceAdded(RnibCell id);
+ /**
+ * Remove CELL.
+ *
+ * @param id CELL ECGI as device id
+ */
void deviceRemoved(DeviceId id);
}
diff --git a/src/main/java/org.onosproject.xran/providers/XranHostListener.java b/src/main/java/org.onosproject.xran/providers/XranHostListener.java
index 79676e3..d545018 100644
--- a/src/main/java/org.onosproject.xran/providers/XranHostListener.java
+++ b/src/main/java/org.onosproject.xran/providers/XranHostListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,22 @@
import java.util.Set;
/**
- * Created by dimitris on 7/28/17.
+ * Xran Host Listener.
*/
public interface XranHostListener {
+ /**
+ * Add UE as a host with location the primary link.
+ *
+ * @param ue UE entity
+ * @param ecgiSet All connected CELLs to this UE
+ */
void hostAdded(RnibUe ue, Set<ECGI> ecgiSet);
+ /**
+ * Remove UE based on Host Id.
+ *
+ * @param id Host Id generated from UE id
+ */
void hostRemoved(HostId id);
}
diff --git a/src/main/java/org.onosproject.xran/providers/package-info.java b/src/main/java/org.onosproject.xran/providers/package-info.java
index a3ee964..608d5f6 100644
--- a/src/main/java/org.onosproject.xran/providers/package-info.java
+++ b/src/main/java/org.onosproject.xran/providers/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/rest/CellWebResource.java b/src/main/java/org.onosproject.xran/rest/CellWebResource.java
index 86438d5..54accd3 100644
--- a/src/main/java/org.onosproject.xran/rest/CellWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/CellWebResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,17 +22,16 @@
import org.onosproject.xran.XranStore;
import org.onosproject.xran.annotations.Patch;
import org.onosproject.xran.controller.XranController;
-import org.onosproject.xran.controller.XranControllerImpl;
import org.onosproject.xran.entities.RnibCell;
-import org.onosproject.xran.rest.ResponseHelper.statusCode;
+import org.onosproject.xran.rest.ResponseHelper.StatusCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.InputStream;
@@ -52,10 +51,10 @@
}
/**
- * test.
+ * Lists the cell with {cellid}.
*
- * @param eciHex test
- * @return test
+ * @param eciHex EutranCellIdentifier in binary
+ * @return Response
*/
@GET
@Path("{cellid}")
@@ -69,7 +68,7 @@
return ResponseHelper.getResponse(
mapper(),
- statusCode.OK,
+ StatusCode.OK,
jsonNode
);
@@ -80,7 +79,7 @@
return ResponseHelper.getResponse(
mapper(),
- statusCode.INTERNAL_SERVER_ERROR,
+ StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -89,18 +88,18 @@
return ResponseHelper.getResponse(
mapper(),
- statusCode.NOT_FOUND,
+ StatusCode.NOT_FOUND,
"Not Found",
"Cell with " + eciHex + " was not found"
);
}
/**
- * test.
+ * Modify the RRMConfig parameters of the cell.
*
- * @param eciHex test
- * @param stream test (body of request)
- * @return test
+ * @param eciHex EutranCellIdentifier in binary
+ * @param stream Parameters that you want to modify
+ * @return Response
*/
@Patch
@Path("{cellid}")
@@ -116,23 +115,24 @@
JsonNode rrmConf = jsonTree.path("RRMConf");
if (!rrmConf.isMissingNode()) {
final SynchronousQueue<String>[] queue = new SynchronousQueue[1];
- get(XranStore.class).modifyCellRrmConf(cell, rrmConf);
+ get(XranStore.class).modifycellrrmconf(cell, rrmConf);
- queue[0] = get(XranController.class).sendModifiedRRMConf(cell.getRrmConfig(),
+ queue[0] = get(XranController.class).sendmodifiedrrmconf(cell.getRrmConfig(),
cell.getVersion() <= 3);
- String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+ String poll = queue[0].poll(get(XranController.class)
+ .getNorthboundTimeout(), TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
mapper(),
- statusCode.OK,
+ StatusCode.OK,
"Handoff Response",
poll
);
} else {
return ResponseHelper.getResponse(
mapper(),
- statusCode.REQUEST_TIMEOUT,
+ StatusCode.REQUEST_TIMEOUT,
"Handoff Timeout",
"eNodeB did not send a HOComplete/HOFailure on time"
);
@@ -141,7 +141,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ StatusCode.BAD_REQUEST,
"Bad Request",
"The command you specified is not implemented or doesn't exist. We support " +
"RRMConf commands."
@@ -153,7 +153,7 @@
return ResponseHelper.getResponse(
mapper(),
- statusCode.INTERNAL_SERVER_ERROR,
+ StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -162,7 +162,7 @@
return ResponseHelper.getResponse(
mapper(),
- statusCode.NOT_FOUND,
+ StatusCode.NOT_FOUND,
"Not Found",
"Cell " + eciHex + " was not found"
);
diff --git a/src/main/java/org.onosproject.xran/rest/LinkWebResource.java b/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
index 20780b3..420d7b4 100644
--- a/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
*/
package org.onosproject.xran.rest;
-import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
@@ -23,23 +22,22 @@
import org.onosproject.rest.AbstractWebResource;
import org.onosproject.xran.XranStore;
import org.onosproject.xran.annotations.Patch;
+import org.onosproject.xran.codecs.ber.types.BerInteger;
import org.onosproject.xran.controller.XranController;
-import org.onosproject.xran.controller.XranControllerImpl;
import org.onosproject.xran.entities.RnibCell;
import org.onosproject.xran.entities.RnibLink;
import org.onosproject.xran.entities.RnibUe;
-import org.onosproject.xran.codecs.ber.types.BerInteger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
-import javax.ws.rs.POST;
import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.POST;
+import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.InputStream;
@@ -62,11 +60,11 @@
}
/**
- * test.
+ * List all the links originating or terminating at cell/UE OR list the link connecting between cell and UE.
*
- * @param eciHex test
- * @param ue test
- * @return test
+ * @param eciHex EutranCellIdentifier in binary
+ * @param ue UE ID
+ * @return Response
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -74,14 +72,14 @@
@DefaultValue("-1") @QueryParam("ue") long ue) {
List<RnibLink> list = Lists.newArrayList();
if (!eciHex.isEmpty() && ue != -1) {
- RnibLink link = get(XranStore.class).getLinkBetweenCellIdUeId(eciHex, ue);
+ RnibLink link = get(XranStore.class).getlinkbetweencellidueid(eciHex, ue);
if (link != null) {
list.add(link);
}
} else if (!eciHex.isEmpty()) {
- list.addAll(get(XranStore.class).getLinksByCellId(eciHex));
+ list.addAll(get(XranStore.class).getlinksbycellid(eciHex));
} else if (ue != -1) {
- list.addAll(get(XranStore.class).getLinksByUeId(ue));
+ list.addAll(get(XranStore.class).getlinksbyueid(ue));
} else {
list.addAll(get(XranStore.class).getLinks());
}
@@ -92,7 +90,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
jsonNode
);
} catch (Exception e) {
@@ -102,7 +100,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+ ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -111,49 +109,52 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Specified links not found"
);
}
/**
- * test.
+ * Modify the link.
*
- * @param src test
- * @param dst test
- * @param stream test
- * @return test
+ * @param src CELL ECI in binary
+ * @param dst UE ID
+ * @param stream Parameter on basis of which link is to be modified
+ * @return Response
*/
@Patch
@Path("{src},{dst}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response patchLinks(@PathParam("src") String src, @PathParam("dst") long dst, InputStream stream) {
- RnibLink link = get(XranStore.class).getLinkBetweenCellIdUeId(src, dst);
+ RnibLink link = get(XranStore.class).getlinkbetweencellidueid(src, dst);
if (link != null) {
try {
ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
+ // Modify link based on Type
JsonNode type = jsonTree.path("type");
if (!type.isMissingNode()) {
RnibLink.Type anEnum = RnibLink.Type.getEnum(type.asText());
return handleTypeChange(link, anEnum);
}
+ // Modify link based on traffic percent
JsonNode trafficpercent = jsonTree.path("trafficpercent");
if (!trafficpercent.isMissingNode()) {
return handleTrafficChange(link, trafficpercent);
}
+ // Modify link based on RRMConf
JsonNode rrmConf = jsonTree.path("RRMConf");
if (!rrmConf.isMissingNode()) {
- return handleRRMChange(link, rrmConf);
+ return handleRrmChange(link, rrmConf);
}
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_IMPLEMENTED,
+ ResponseHelper.StatusCode.NOT_IMPLEMENTED,
"Not Implemented",
"The command you specified is not implemented or doesn't exist. We support " +
"type/RRMConf/traficpercent commands."
@@ -166,7 +167,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+ ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -175,19 +176,19 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Link not found use POST request"
);
}
/**
- * test.
+ * Create link based on Type of the link.
*
- * @param src test
- * @param dst test
- * @param stream test
- * @return test
+ * @param src CELL ECI in binary
+ * @param dst UE ID
+ * @param stream LinkType
+ * @return Response
*/
@POST
@Path("{src},{dst}")
@@ -200,7 +201,7 @@
if (cell == null) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Cell " + src + " was not found"
);
@@ -209,7 +210,7 @@
if (ue == null) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Ue with " + dst + " was not found"
);
@@ -218,7 +219,7 @@
if (get(XranStore.class).getLink(cell.getEcgi(), ue.getId()) != null) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
"Link already exists use PATCH to modify"
);
@@ -243,7 +244,7 @@
JsonNode rrmConf = jsonTree.path("RRMConf");
if (!rrmConf.isMissingNode()) {
- return handleRRMChange(link, rrmConf);
+ return handleRrmChange(link, rrmConf);
}
} catch (Exception e) {
@@ -253,7 +254,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+ ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -261,22 +262,34 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
- "The command you specified is not implemented or doesn't exist. We support " +
+ "The command you specified is not implemented " +
+ "or doesn't exist. We support " +
"type/RRMConf/traficpercent commands."
);
}
- private Response handleTypeChange(RnibLink link, RnibLink.Type newType) throws InterruptedException {
+
+ /**
+ * Change link based on type of the link.
+ *
+ * @param link Link
+ * @param newType LinkType
+ * @return Response
+ * @throws InterruptedException Interrupted queue
+ */
+ private Response handleTypeChange(RnibLink link, RnibLink.Type newType)
+ throws InterruptedException {
final SynchronousQueue<String>[] queue = new SynchronousQueue[1];
+
if (newType.equals(RnibLink.Type.SERVING_PRIMARY)) {
switch (link.getType()) {
case SERVING_PRIMARY: {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
"Link is already a primary link"
);
@@ -284,26 +297,28 @@
case SERVING_SECONDARY_CA:
case SERVING_SECONDARY_DC:
case NON_SERVING: {
- List<RnibLink> linksByUeId = get(XranStore.class).getLinksByUeId(link.getLinkId().getUeId());
+ List<RnibLink> linksByUeId = get(XranStore.class)
+ .getlinksbyueid(link.getLinkId().getUeId());
Optional<RnibLink> primary = linksByUeId.stream()
.filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
.findFirst();
if (primary.isPresent()) {
queue[0] = get(XranController.class).sendHORequest(link, primary.get());
- String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+ String poll = queue[0].poll(get(XranController.class)
+ .getNorthboundTimeout(), TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
"Handoff Response",
poll
);
} else {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.REQUEST_TIMEOUT,
+ ResponseHelper.StatusCode.REQUEST_TIMEOUT,
"Handoff Timeout",
"eNodeB did not send a HOComplete/HOFailure on time"
);
@@ -312,93 +327,110 @@
link.setType(RnibLink.Type.SERVING_PRIMARY);
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
"OK",
"Link set to primary"
);
}
}
+ default:
}
} else if (newType.equals(RnibLink.Type.NON_SERVING)) {
switch (link.getType()) {
- case NON_SERVING:
+ case NON_SERVING: {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
"Link is already a primary link"
);
- case SERVING_PRIMARY:
+ }
+ case SERVING_PRIMARY: {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
"Cannot modify a primary link"
);
+ }
case SERVING_SECONDARY_CA:
- case SERVING_SECONDARY_DC:
+ case SERVING_SECONDARY_DC: {
if (get(XranController.class).sendScellDelete(link)) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
"OK",
"Link set to non-serving"
);
} else {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Could not find cell config report to construct Scell Delete"
);
}
+ }
+ default:
}
} else if (newType.equals(RnibLink.Type.SERVING_SECONDARY_CA)) {
switch (link.getType()) {
- case SERVING_PRIMARY:
+ case SERVING_PRIMARY: {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
"Cannot modify a primary link"
);
+ }
case SERVING_SECONDARY_DC:
- case NON_SERVING:
+ case NON_SERVING: {
queue[0] = get(XranController.class).sendScellAdd(link);
- String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+ String poll = queue[0].poll(get(XranController.class)
+ .getNorthboundTimeout(), TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
"ScellAdd Response",
poll
);
} else {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.REQUEST_TIMEOUT,
+ ResponseHelper.StatusCode.REQUEST_TIMEOUT,
"ScellAdd Timeout",
"eNodeB did not send a ScellAddStatus on time"
);
}
- case SERVING_SECONDARY_CA:
+ }
+ case SERVING_SECONDARY_CA: {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
"Link is already a secondary CA link"
);
+ }
+ default:
}
}
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.BAD_REQUEST,
+ ResponseHelper.StatusCode.BAD_REQUEST,
"Bad Request",
"The command you specified is not implemented or doesn't exist."
);
}
+ /**
+ * Modify link based on the traffic percent.
+ *
+ * @param link Link
+ * @param trafficpercent Traffic Percent of the link to be modified
+ * @return Response
+ */
private Response handleTrafficChange(RnibLink link, JsonNode trafficpercent) {
JsonNode jsonNode = trafficpercent.path("traffic-percent-dl");
if (!jsonNode.isMissingNode()) {
@@ -412,41 +444,49 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
"OK",
"Traffic Percent changed"
);
}
- private Response handleRRMChange(RnibLink link, JsonNode rrmConf) throws InterruptedException {
+ /**
+ * Modify link based on RRMConf parameters.
+ *
+ * @param link Link
+ * @param rrmConf RRMConfig of the Link to be modified
+ * @return Response
+ * @throws InterruptedException Interrupted queue
+ */
+ private Response handleRrmChange(RnibLink link, JsonNode rrmConf) throws InterruptedException {
final SynchronousQueue<String>[] queue = new SynchronousQueue[1];
- get(XranStore.class).modifyLinkRrmConf(link, rrmConf);
- boolean isxICIC = link.getLinkId().getCell().getVersion() <= 3;
+ get(XranStore.class).modifylinkrrmconf(link, rrmConf);
+ boolean isxicic = link.getLinkId().getCell().getVersion() <= 3;
- queue[0] = get(XranController.class).sendModifiedRRMConf(link.getRrmParameters(),
- isxICIC);
+ queue[0] = get(XranController.class).sendmodifiedrrmconf(link.getRrmParameters(),
+ isxicic);
- if (isxICIC) {
+ if (isxicic) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
"OK",
"xICIC was sent successfully"
);
} else {
- String poll = queue[0].poll(get(XranController.class).getNorthbound_timeout(), TimeUnit.MILLISECONDS);
+ String poll = queue[0].poll(get(XranController.class).getNorthboundTimeout(), TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
"RRMConfig Response",
poll
);
} else {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.REQUEST_TIMEOUT,
+ ResponseHelper.StatusCode.REQUEST_TIMEOUT,
"RRMConfig Timeout",
"eNodeB did not send a RRMConfingStatus on time"
);
diff --git a/src/main/java/org.onosproject.xran/rest/NodeWebResource.java b/src/main/java/org.onosproject.xran/rest/NodeWebResource.java
index 2b9124c..961ed19 100644
--- a/src/main/java/org.onosproject.xran/rest/NodeWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/NodeWebResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,24 +15,20 @@
*/
package org.onosproject.xran.rest;
-import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.onosproject.rest.AbstractWebResource;
import org.onosproject.xran.XranStore;
-import org.onosproject.xran.entities.RnibCell;
-import org.onosproject.xran.entities.RnibUe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@@ -51,10 +47,10 @@
}
/**
- * test.
+ * List all the nodes in the R-NIB.
*
- * @param type test
- * @return test
+ * @param type Type of node (cell/ue)
+ * @return Response
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -62,16 +58,17 @@
JsonNode jsonNode;
try {
List<Object> nodes;
+ // List cell type of nodes or UE type of nodes.
if (StringUtils.isBlank(type)) {
nodes = get(XranStore.class).getNodes();
} else if (type.equals("cell")) {
- nodes = get(XranStore.class).getCellNodes();
+ nodes = get(XranStore.class).getcellnodes();
} else if (type.equals("ue")) {
- nodes = get(XranStore.class).getUeNodes();
+ nodes = get(XranStore.class).getuenodes();
} else {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Type of node was not found"
);
@@ -80,7 +77,7 @@
if (nodes.size() == 0) {
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"No nodes found"
);
@@ -94,7 +91,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+ ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -102,22 +99,22 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
jsonNode
);
}
/**
- * test.
+ * List the node with a specific node id.
*
- * @param nodeid test
- * @return test
+ * @param nodeid ID of the node
+ * @return Response
*/
@GET
@Path("{nodeid}")
@Produces(MediaType.APPLICATION_JSON)
public Response getNodeid(@PathParam("nodeid") String nodeid) {
- Object node = get(XranStore.class).getByNodeId(nodeid);
+ Object node = get(XranStore.class).getbynodeid(nodeid);
if (node != null) {
try {
@@ -125,7 +122,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
jsonNode
);
} catch (Exception e) {
@@ -135,7 +132,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+ ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -144,7 +141,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Node " + nodeid + " was not found"
);
diff --git a/src/main/java/org.onosproject.xran/rest/ResponseHelper.java b/src/main/java/org.onosproject.xran/rest/ResponseHelper.java
index 5e2f1dd..f037cee 100644
--- a/src/main/java/org.onosproject.xran/rest/ResponseHelper.java
+++ b/src/main/java/org.onosproject.xran/rest/ResponseHelper.java
@@ -23,9 +23,15 @@
import javax.ws.rs.core.Response;
-public class ResponseHelper {
+/**
+ * Various types of responses.
+ */
+public final class ResponseHelper {
- public static Response getResponse(ObjectMapper mapper, statusCode status, String title, String detail) {
+ private ResponseHelper() {
+ }
+
+ public static Response getResponse(ObjectMapper mapper, StatusCode status, String title, String detail) {
ObjectNode rootNode = mapper.createObjectNode();
switch (status) {
@@ -58,7 +64,7 @@
}
}
- public static Response getResponse(ObjectMapper mapper, statusCode status, JsonNode node) {
+ public static Response getResponse(ObjectMapper mapper, StatusCode status, JsonNode node) {
ObjectNode rootNode = mapper.createObjectNode();
switch (status) {
@@ -79,7 +85,7 @@
}
}
- public enum statusCode {
+ public enum StatusCode {
OK(200),
BAD_REQUEST(400),
NOT_FOUND(404),
@@ -89,7 +95,7 @@
public int status;
- statusCode(int status) {
+ StatusCode(int status) {
this.status = status;
}
}
diff --git a/src/main/java/org.onosproject.xran/rest/SliceWebResource.java b/src/main/java/org.onosproject.xran/rest/SliceWebResource.java
index 58b4bef..8817be8 100644
--- a/src/main/java/org.onosproject.xran/rest/SliceWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/SliceWebResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
*/
package org.onosproject.xran.rest;
-import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.onosproject.rest.AbstractWebResource;
@@ -32,7 +31,6 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.io.IOException;
import java.io.InputStream;
/**
@@ -49,10 +47,10 @@
}
/**
- * test.
+ * List the slice with the given slice ID.
*
- * @param sliceid test
- * @return test
+ * @param sliceid ID of the slice
+ * @return Response
*/
@GET
@Path("{sliceid}")
@@ -66,7 +64,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.OK,
+ ResponseHelper.StatusCode.OK,
jsonNode
);
} catch (Exception e) {
@@ -76,7 +74,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+ ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
@@ -85,17 +83,17 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_FOUND,
+ ResponseHelper.StatusCode.NOT_FOUND,
"Not Found",
"Slice " + sliceid + " not found"
);
}
/**
- * test.
+ * Create slice with the corresponding attributes.
*
- * @param stream test
- * @return test
+ * @param stream Attributes to create slice
+ * @return Response
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@@ -108,7 +106,7 @@
// FIXME: change when implemented
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.NOT_IMPLEMENTED,
+ ResponseHelper.StatusCode.NOT_IMPLEMENTED,
"Not Implemented",
"POST Slice not implemented"
);
@@ -119,7 +117,7 @@
return ResponseHelper.getResponse(
mapper(),
- ResponseHelper.statusCode.INTERNAL_SERVER_ERROR,
+ ResponseHelper.StatusCode.INTERNAL_SERVER_ERROR,
"Exception",
fullStackTrace
);
diff --git a/src/main/java/org.onosproject.xran/rest/XranWebApplication.java b/src/main/java/org.onosproject.xran/rest/XranWebApplication.java
index 30f584b..fff752f 100644
--- a/src/main/java/org.onosproject.xran/rest/XranWebApplication.java
+++ b/src/main/java/org.onosproject.xran/rest/XranWebApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/rest/package-info.java b/src/main/java/org.onosproject.xran/rest/package-info.java
index 16f0c2f..c08814c 100644
--- a/src/main/java/org.onosproject.xran/rest/package-info.java
+++ b/src/main/java/org.onosproject.xran/rest/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/org.onosproject.xran/wrapper/CellMap.java b/src/main/java/org.onosproject.xran/wrapper/CellMap.java
index ea4fc77..6685189 100644
--- a/src/main/java/org.onosproject.xran/wrapper/CellMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/CellMap.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,20 +19,22 @@
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import io.netty.channel.ChannelHandlerContext;
-import org.onosproject.net.DeviceId;
import org.onosproject.xran.XranStore;
import org.onosproject.xran.codecs.api.ECGI;
import org.onosproject.xran.codecs.api.PCIARFCN;
import org.onosproject.xran.entities.RnibCell;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+/**
+ * CELL wrapper to help put/get/remove.
+ */
public class CellMap {
+ // map to get the context channel based on ecgi
private ConcurrentMap<ECGI, ChannelHandlerContext> ecgiCtx = new ConcurrentHashMap<>();
+ // pci-arfcn to ecgi bimap
private BiMap<PCIARFCN, ECGI> pciarfcnMap = HashBiMap.create();
private XranStore xranStore;
@@ -40,13 +42,22 @@
this.xranStore = xranStore;
}
+ /**
+ * Put the PCI-ARFCN to ECGI map from new cell.
+ *
+ * @param value CELL entity
+ */
public void putPciArfcn(RnibCell value) {
- PCIARFCN pciarfcn = new PCIARFCN();
- pciarfcn.setPci(value.getConf().getPci());
- pciarfcn.setEarfcnDl(value.getConf().getEarfcnDl());
+ PCIARFCN pciarfcn = PCIARFCN.valueOf(value.getConf().getPci(), value.getConf().getEarfcnDl());
pciarfcnMap.put(pciarfcn, value.getEcgi());
}
+ /**
+ * Put inside ECGI to CTX map.
+ *
+ * @param value CELL entity to get ECGI from
+ * @param ctx context channel
+ */
public void put(RnibCell value, ChannelHandlerContext ctx) {
if (value.getEcgi() != null) {
ecgiCtx.put(value.getEcgi(), ctx);
@@ -54,8 +65,14 @@
}
}
+ /**
+ * Get cell based on PCI-ARFCN.
+ *
+ * @param id PCI-ARFCN
+ * @return CELL entity if found
+ */
public RnibCell get(PCIARFCN id) {
- ECGI ecgi = null;
+ ECGI ecgi;
ecgi = pciarfcnMap.get(id);
if (ecgi != null) {
@@ -64,6 +81,12 @@
return null;
}
+ /**
+ * Get cell based on ECGI.
+ *
+ * @param ecgi CELL ECGI
+ * @return CELL entity if found
+ */
public RnibCell get(ECGI ecgi) {
if (ecgi != null) {
return xranStore.getCell(ecgi);
@@ -71,6 +94,12 @@
return null;
}
+ /**
+ * Remove cell from three maps based on ECGI or PCI-ARFCN.
+ *
+ * @param key ecgECGIi or pci-arfcn of cell to remove
+ * @return true if remove succeeded
+ */
public boolean remove(Object key) {
ECGI ecgi = null;
if (key instanceof ECGI) {
@@ -87,6 +116,12 @@
return ecgi != null && xranStore.removeCell(ecgi);
}
+ /**
+ * Get context handler for specified ECGI.
+ *
+ * @param id CELL ECGI
+ * @return context handler if found
+ */
public ChannelHandlerContext getCtx(ECGI id) {
return ecgiCtx.get(id);
}
diff --git a/src/main/java/org.onosproject.xran/wrapper/LinkMap.java b/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
index ed7b4f1..543879d 100644
--- a/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,9 @@
import static org.slf4j.LoggerFactory.getLogger;
+/**
+ * LINK wrapper to help put/get/remove.
+ */
public class LinkMap {
private static final Logger log = getLogger(LinkMap.class);
@@ -41,14 +44,28 @@
this.ueMap = ueMap;
}
+ /**
+ * Put a new primary link between a CELL and a UE.
+ *
+ * @param cell CELL entity
+ * @param ue UE entity
+ */
public void putPrimaryLink(RnibCell cell, RnibUe ue) {
RnibLink link = new RnibLink(cell, ue);
+ // set link to primary before storing
link.setType(RnibLink.Type.SERVING_PRIMARY);
xranStore.storeLink(link);
ueMap.putCrnti(cell, ue);
}
+ /**
+ * Put non-serving link based on CELL and CRNTI.
+ *
+ * @param cell CELL entity
+ * @param crnti CRNTI
+ * @return new link after creation
+ */
public RnibLink putNonServingLink(RnibCell cell, CRNTI crnti) {
RnibLink link = null;
RnibUe ue = ueMap.get(cell.getEcgi(), crnti);
@@ -62,6 +79,13 @@
return link;
}
+ /**
+ * Put non-serving link based on CELL and UE id.
+ *
+ * @param cell CELL entity
+ * @param ueId UE id
+ * @return new link after creation
+ */
public RnibLink putNonServingLink(RnibCell cell, Long ueId) {
RnibLink link = null;
RnibUe ue = ueMap.get(ueId);
@@ -75,6 +99,13 @@
return link;
}
+ /**
+ * Get link based on ECGI and UE id.
+ *
+ * @param src CELL ECGI
+ * @param dst UE ID
+ * @return link if found
+ */
public RnibLink get(ECGI src, Long dst) {
if (src != null && dst != null) {
return xranStore.getLink(src, dst);
@@ -82,6 +113,13 @@
return null;
}
+ /**
+ * Get link based on ECGI and CRNTI.
+ *
+ * @param src CELL ECGI
+ * @param dst CELL unique CRNTI
+ * @return link if found
+ */
public RnibLink get(ECGI src, CRNTI dst) {
RnibUe ue = ueMap.get(src, dst);
@@ -91,12 +129,27 @@
return null;
}
+ /**
+ * Get CRNTI based on UE id.
+ *
+ * @param ueId UE id
+ * @return UE if found
+ */
public CRNTI getCrnti(Long ueId) {
return ueMap.getCrntUe().inverse().get(ueId).getValue();
}
+ /**
+ * Get primary CELL for specified UE.
+ *
+ * @param ue UE entity
+ * @return primary CELL if found
+ */
public RnibCell getPrimaryCell(RnibUe ue) {
- List<RnibLink> linksByUeId = xranStore.getLinksByUeId(ue.getId());
+ List<RnibLink> linksByUeId = xranStore.getlinksbyueid(ue.getId());
+
+ // TODO: search for primary link from crntUe in UeMap because it has the primary links only!
+ // search all links for this UE and find PRIMARY.
Optional<RnibLink> primary = linksByUeId.stream()
.filter(l -> l.getType().equals(RnibLink.Type.SERVING_PRIMARY))
.findFirst();
diff --git a/src/main/java/org.onosproject.xran/wrapper/UeMap.java b/src/main/java/org.onosproject.xran/wrapper/UeMap.java
index 8b2110d..6ebab70 100644
--- a/src/main/java/org.onosproject.xran/wrapper/UeMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/UeMap.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,12 +21,15 @@
import org.onosproject.xran.XranStore;
import org.onosproject.xran.codecs.api.CRNTI;
import org.onosproject.xran.codecs.api.ECGI;
-import org.onosproject.xran.codecs.api.MMEUES1APID;
import org.onosproject.xran.entities.RnibCell;
import org.onosproject.xran.entities.RnibUe;
import org.onosproject.xran.identifiers.EcgiCrntiPair;
+/**
+ * UE wrapper to help put/get/remove.
+ */
public class UeMap {
+ // ECGI, CRNTI pair of primary cell for specified UE.
private BiMap<EcgiCrntiPair, Long> crntUe = HashBiMap.create();
private XranStore xranStore;
@@ -35,30 +38,58 @@
this.xranStore = xranStore;
}
+ /**
+ * Get the ECGI, CRNTI to UE bimap.
+ *
+ * @return BiMap of EcgiCrntiPair to Long
+ */
public BiMap<EcgiCrntiPair, Long> getCrntUe() {
return crntUe;
}
+ /**
+ * Put new ECGI, CRNTI pair of primary link to UE and remove old one.
+ *
+ * @param cell new primary CELL
+ * @param ue UE
+ */
public void putCrnti(RnibCell cell, RnibUe ue) {
- CRNTI ranId = ue.getCrnti();
+ CRNTI crnti = ue.getCrnti();
ECGI ecgi = cell.getEcgi();
- if (ranId != null && ecgi != null) {
+
+ if (crnti != null && ecgi != null) {
+ // check if there is an ecgi, crnti pair for this UE id.
EcgiCrntiPair oldPair = crntUe.inverse().get(ue.getId()),
newPair = EcgiCrntiPair.valueOf(cell.getEcgi(), ue.getCrnti());
if (oldPair == null) {
crntUe.put(newPair, ue.getId());
} else {
+ // remove old pair and add the new pair which corresponds to the primary cell.
crntUe.inverse().remove(ue.getId());
crntUe.put(newPair, ue.getId());
}
}
}
+ /**
+ * Put new UE to the store and update the ECGI, CRNTI pair.
+ *
+ * @param cell new primary CELL
+ * @param ue UE
+ */
public void put(RnibCell cell, RnibUe ue) {
xranStore.storeUe(ue);
+ // after adding new primary cell update the bimap as well.
putCrnti(cell, ue);
}
+ /**
+ * Get UE based on ECGI and CRNTI.
+ *
+ * @param ecgi CELL ECGI
+ * @param crnti CELL unique CRNTI
+ * @return UE entity if found
+ */
public RnibUe get(ECGI ecgi, CRNTI crnti) {
Long aLong = crntUe.get(EcgiCrntiPair.valueOf(ecgi, crnti));
if (aLong != null) {
@@ -67,10 +98,22 @@
return null;
}
+ /**
+ * Get UE based on its id.
+ *
+ * @param ueId UE id
+ * @return UE entity if found
+ */
public RnibUe get(Long ueId) {
return xranStore.getUe(ueId);
}
+ /**
+ * Remove UE based on its id.
+ *
+ * @param ueId UE id
+ * @return true if remove succeeded
+ */
public boolean remove(Long ueId) {
crntUe.inverse().remove(ueId);
return xranStore.removeUe(ueId);
diff --git a/src/main/java/org.onosproject.xran/wrapper/package-info.java b/src/main/java/org.onosproject.xran/wrapper/package-info.java
index c724c32..7718d8e 100644
--- a/src/main/java/org.onosproject.xran/wrapper/package-info.java
+++ b/src/main/java/org.onosproject.xran/wrapper/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,4 +14,7 @@
* limitations under the License.
*/
+/**
+ * Created by dimitris on 7/20/17.
+ */
package org.onosproject.xran.wrapper;
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index f0919ca..4520f46 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2016-present Open Networking Laboratory
+ ~ Copyright 2016-present Open Networking Foundation
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.