added HO and RRMConf NB api
diff --git a/src/main/java/org.onosproject.xran/entities/RnibCell.java b/src/main/java/org.onosproject.xran/entities/RnibCell.java
index 3aa5c89..d917f02 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibCell.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibCell.java
@@ -19,13 +19,14 @@
import com.fasterxml.jackson.databind.JsonNode;
import org.onosproject.net.DeviceId;
import org.onosproject.xran.codecs.api.ECGI;
-import org.onosproject.xran.codecs.api.MMEUES1APID;
import org.onosproject.xran.codecs.api.PRBUsage;
import org.onosproject.xran.codecs.pdu.CellConfigReport;
import org.onosproject.xran.codecs.pdu.L2MeasConfig;
import org.onosproject.xran.codecs.pdu.RRMConfig;
import org.onosproject.xran.codecs.pdu.SchedMeasReportPerCell;
import org.openmuc.jasn1.ber.BerByteArrayOutputStream;
+import org.openmuc.jasn1.ber.types.BerBitString;
+import org.openmuc.jasn1.ber.types.BerInteger;
import javax.xml.bind.DatatypeConverter;
import java.io.ByteArrayInputStream;
@@ -33,6 +34,7 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.List;
/**
* Created by dimitris on 7/22/17.
@@ -49,6 +51,8 @@
public RnibCell() {
prbUsage = new PrbUsageContainer();
+ setDefaultRRMConf();
+
}
public static URI uri(ECGI ecgi) {
@@ -77,6 +81,65 @@
return ecgi;
}
+ public RRMConfig getRrmConfig() {
+ return rrmConfig;
+ }
+
+ public void setRrmConfig(RRMConfig rrmConfig) {
+ this.rrmConfig = rrmConfig;
+ }
+
+ public PrbUsageContainer getPrbUsage() {
+ return prbUsage;
+ }
+
+ public void setPrbUsage(PrbUsageContainer prbUsage) {
+ this.prbUsage = prbUsage;
+ }
+
+ private void setDefaultRRMConf() {
+ rrmConfig = new RRMConfig();
+
+ RRMConfig.Crnti crnti2 = new RRMConfig.Crnti();
+
+ rrmConfig.setCrnti(crnti2);
+
+ rrmConfig.setEcgi(ecgi);
+
+ RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
+ startPrbDl.addBerInteger(new BerInteger(0));
+ startPrbDl.addBerInteger(new BerInteger(50));
+
+ rrmConfig.setStartPrbDl(startPrbDl);
+
+ RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl();
+ startPrbUl.addBerInteger(new BerInteger(50));
+ startPrbUl.addBerInteger(new BerInteger(100));
+
+ rrmConfig.setStartPrbUl(startPrbUl);
+
+ RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
+ endPrbDl.addBerInteger(new BerInteger(50));
+ endPrbDl.addBerInteger(new BerInteger(100));
+
+ rrmConfig.setEndPrbDl(endPrbDl);
+
+ RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl();
+ endPrbUl.addBerInteger(new BerInteger(50));
+ endPrbUl.addBerInteger(new BerInteger(100));
+
+ rrmConfig.setEndPrbUl(endPrbUl);
+
+ RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl();
+ BerBitString berBitString = new BerBitString(new byte[]{(byte) 0xAA, (byte) 0x80}, 10);
+ BerBitString berBitString1 = new BerBitString(new byte[]{(byte) 0x55, (byte) 0x40}, 10);
+
+ subframeBitmaskDl.addBerBitString(berBitString);
+ subframeBitmaskDl.addBerBitString(berBitString1);
+
+ rrmConfig.setSubframeBitmaskDl(subframeBitmaskDl);
+ }
+
public ECGI getEcgi() {
return ecgi;
}
@@ -89,15 +152,40 @@
return conf;
}
+ /*public RRMConfig getRrmConfig() {
+ return rrmConfig;
+ }*/
+
public void setConf(CellConfigReport conf) {
this.conf = conf;
}
- public RRMConfig getRrmConfig() {
- return rrmConfig;
- }
+ public void modifyRrmConfig(JsonNode rrmConfigNode, List<RnibUe> ueList) {
+ RRMConfig.Crnti crnti = new RRMConfig.Crnti();
+ ueList.forEach(ue -> crnti.addCRNTI(ue.getRanId()));
- public void modifyRrmConfig(JsonNode rrmConfig) {
+ RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl();
+ RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl();
+ int i = 0;
+ if (rrmConfigNode.get("start_prb_dl").isArray()) {
+ for (final JsonNode config : rrmConfigNode) {
+ startPrbDl.getSeqOf().set(i, new BerInteger(config.asInt()));
+ i++;
+ }
+ }
+ i = 0;
+ if (rrmConfigNode.get("end_prb_dl").isArray()) {
+ for (final JsonNode config : rrmConfigNode) {
+ endPrbDl.getSeqOf().set(i, new BerInteger(config.asInt()));
+ i++;
+ }
+ }
+ rrmConfig.setEndPrbDl(endPrbDl);
+ rrmConfig.setStartPrbDl(startPrbDl);
+ rrmConfig.setCrnti(crnti);
+ rrmConfig.setEcgi(ecgi);
+
+
// TODO
}
diff --git a/src/main/java/org.onosproject.xran/entities/RnibLink.java b/src/main/java/org.onosproject.xran/entities/RnibLink.java
index eb61120..d9f39cc 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibLink.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibLink.java
@@ -22,6 +22,8 @@
import org.onosproject.xran.identifiers.LinkId;
import org.openmuc.jasn1.ber.types.BerInteger;
+import java.util.Arrays;
+import java.util.Optional;
import java.util.Timer;
/**
@@ -42,8 +44,9 @@
private Type type;
private Timer timer;
- public RnibLink() {
+ public RnibLink(RnibCell cell, RnibUe ue) {
trafficPercent = new TrafficSplitPercentage();
+ trafficPercent.setEcgi(cell.getEcgi());
trafficPercent.setTrafficPercentDl(new BerInteger(100));
trafficPercent.setTrafficPercentUl(new BerInteger(100));
@@ -52,6 +55,10 @@
pdcpPackDelay = new PDCPPacketDelay();
resourceUsage = new ResourceUsage();
timer = new Timer();
+
+ type = Type.NON_SERVING;
+
+ linkId = LinkId.valueOf(cell, ue);
}
public Timer getTimer() {
@@ -73,7 +80,7 @@
}
public void setLinkId(RnibCell cell, RnibUe ue) {
- this.linkId = new LinkId(cell.getEcgi(), ue.getMmeS1apId());
+ this.linkId = LinkId.valueOf(cell, ue);
trafficPercent.setEcgi(cell.getEcgi());
}
@@ -174,24 +181,38 @@
}
public enum Type {
- SERVING_PRIMARY {
+ SERVING_PRIMARY("serving/primary") {
@Override
public String toString() {
return "\"serving/primary\"";
}
},
// TODO: Add CA/DC
- SERVING_SECONDARY {
+ SERVING_SECONDARY("serving/secondary") {
@Override
public String toString() {
return "\"serving/secondary\"";
}
},
- NON_SERVING {
+ NON_SERVING("non-serving") {
@Override
public String toString() {
return "\"non-serving\"";
}
+ };
+
+ private String name;
+
+ Type(String name) {
+ this.name = name;
+ }
+
+ public static Type getEnum(String name) {
+ Optional<Type> any = Arrays.stream(Type.values()).filter(typeStr -> typeStr.name.equals(name)).findAny();
+ if (any.isPresent()) {
+ return any.get();
+ }
+ throw new IllegalArgumentException("No enum defined for string: " + name);
}
}
diff --git a/src/main/java/org.onosproject.xran/entities/RnibUe.java b/src/main/java/org.onosproject.xran/entities/RnibUe.java
index 2be3e01..b58e77e 100644
--- a/src/main/java/org.onosproject.xran/entities/RnibUe.java
+++ b/src/main/java/org.onosproject.xran/entities/RnibUe.java
@@ -48,13 +48,13 @@
private ENBUES1APID enbS1apId;
private MMEUES1APID mmeS1apId;
private CRNTI ranId;
- private UeState ueState;
+ private State state;
private UECapabilityInfo capability;
private RXSigMeasConfig measConfig;
private Timer timer;
public RnibUe() {
- ueState = UeState.ACTIVE;
+ state = State.ACTIVE;
timer = new Timer();
}
@@ -174,12 +174,12 @@
this.capability = capability;
}
- public UeState getUeState() {
- return ueState;
+ public State getState() {
+ return state;
}
- public void setUeState(UeState ueState) {
- this.ueState = ueState;
+ public void setState(State state) {
+ this.state = state;
}
@Override
@@ -190,7 +190,7 @@
.append(enbS1apId != null ? ",\n\"enb-s1-ap-id\":" + enbS1apId : "")
.append(imsi != null ? ",\"imsi\":" + imsi : "")
.append(ranId != null ? ",\n\"ran-id\":" + ranId : "")
- .append(ueState != null ? ",\n\"state\":" + ueState : "")
+ .append(state != null ? ",\n\"state\":" + state : "")
.append(capability != null ? ",\n\"capability\":" + capability : "")
.append(measConfig != null ? ",\n\"meas-config\":" + measConfig : "")
.append("\n}\n");
@@ -214,7 +214,7 @@
return result;
}
- public enum UeState {
+ public enum State {
ACTIVE {
@Override
public String toString() {