CRNTI to be unique per cell, added fields in configuration, rx_signal from seconds to ms, on cell connection we resend meascells
diff --git a/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java b/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
index eeb2966..9497bf4 100644
--- a/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
+++ b/src/main/java/org.onosproject.xran/controller/XranControllerImpl.java
@@ -80,6 +80,7 @@
private final Controller controller = new Controller();
private XranConfig xranConfig;
private ApplicationId appId;
+ public int northbound_timeout;
/* Services */
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private DeviceService deviceService;
@@ -131,7 +132,7 @@
cellMap = new CellMap(xranStore);
ueMap = new UeMap(xranStore);
- linkMap = new LinkMap(xranStore);
+ linkMap = new LinkMap(xranStore, ueMap);
xranStore.setController(this);
@@ -290,7 +291,6 @@
private void restartTimer(RnibUe ue) {
Timer timer = new Timer();
ue.setTimer(timer);
- log.info("Starting UE timer...");
timer.schedule(new TimerTask() {
@Override
public void run() {
@@ -301,13 +301,12 @@
log.info("UE not removed cause its ACTIVE");
}
}
- }, 10000);
+ }, xranConfig.getIdleUeRemoval());
}
private void restartTimer(RnibLink link) {
Timer timer = new Timer();
link.setTimer(timer);
- log.info("Starting Link timer...");
timer.schedule(new TimerTask() {
@Override
public void run() {
@@ -315,7 +314,7 @@
xranStore.removeLink(linkId);
log.info("Link is removed after not receiving Meas Reports for 10 seconds");
}
- }, 10000);
+ }, xranConfig.getNoMeasLinkRemoval());
}
@@ -346,9 +345,38 @@
e.printStackTrace();
}
} else {
+ 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 -> {
+ 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_ecgi,
+ ue.getRanId(),
+ measCells,
+ xranConfig.getRxSignalInterval()
+ );
+ ue.setMeasConfig(xrancPdu.getBody().getRXSigMeasConfig());
+ ctx.writeAndFlush(getSctpMessage(xrancPdu));
+ } catch (IOException e) {
+ log.warn(ExceptionUtils.getFullStackTrace(e));
+ e.printStackTrace();
+ }
+ });
+
try {
- ChannelHandlerContext ctx = cellMap.
- getCtx(ecgi);
+ ChannelHandlerContext ctx = cellMap.getCtx(ecgi);
XrancPdu xrancPdu = L2MeasConfig.constructPacket(ecgi, xranConfig.getL2MeasInterval());
cell.setMeasConfig(xrancPdu.getBody().getL2MeasConfig());
SctpMessage sctpMessage = getSctpMessage(xrancPdu);
@@ -435,7 +463,7 @@
primary.getEcgi(),
ue.getRanId(),
measCells,
- xranConfig.getRxSignalInterval() * 1000
+ xranConfig.getRxSignalInterval()
);
ue.setMeasConfig(xrancPdu.getBody().getRXSigMeasConfig());
ctx.writeAndFlush(getSctpMessage(xrancPdu));
@@ -520,7 +548,7 @@
}
return true;
} else {
- ueMap.put(ue);
+ ueMap.put(cell, ue);
linkMap.putPrimaryLink(cell, ue);
Set<ECGI> ecgiSet = Sets.newConcurrentHashSet();
@@ -585,7 +613,7 @@
// Decode UE Admission Status.
UEAdmissionStatus ueAdmissionStatus = recv_pdu.getBody().getUEAdmissionStatus();
- RnibUe ue = ueMap.get(ueAdmissionStatus.getCrnti());
+ RnibUe ue = ueMap.get(ueAdmissionStatus.getEcgi(), ueAdmissionStatus.getCrnti());
if (ue != null) {
if (ueAdmissionStatus.getAdmEstStatus().value.intValue() == 0) {
ue.setState(RnibUe.State.ACTIVE);
@@ -616,7 +644,7 @@
case 6: {
// Decode UE Reconfig_Ind.
UEReconfigInd ueReconfigInd = recv_pdu.getBody().getUEReconfigInd();
- RnibUe ue = ueMap.get(ueReconfigInd.getCrntiOld());
+ RnibUe ue = ueMap.get(ueReconfigInd.getEcgi(), ueReconfigInd.getCrntiOld());
if (ue != null) {
ue.setRanId(ueReconfigInd.getCrntiNew());
@@ -629,7 +657,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.getCrnti());
+ RnibUe ue = ueMap.get(ueReleaseInd.getEcgi(), ueReleaseInd.getCrnti());
if (ue != null) {
ue.setState(RnibUe.State.IDLE);
restartTimer(ue);
@@ -862,7 +890,7 @@
// Decode UE Capability Info
UECapabilityInfo capabilityInfo = recv_pdu.getBody().getUECapabilityInfo();
- RnibUe ue = ueMap.get(capabilityInfo.getCrnti());
+ RnibUe ue = ueMap.get(capabilityInfo.getEcgi(), capabilityInfo.getCrnti());
if (ue != null) {
ue.setCapability(capabilityInfo);
} else {
@@ -978,6 +1006,8 @@
xranConfig = (XranConfig) config.get();
+ northbound_timeout = xranConfig.getNorthBoundTimeout();
+
legitCells.putAll(xranConfig.activeCellSet());
controller.start(deviceAgent, hostAgent, packetAgent, xranConfig.getXrancPort());
diff --git a/src/main/java/org.onosproject.xran/impl/XranConfig.java b/src/main/java/org.onosproject.xran/impl/XranConfig.java
index 03cbe13..eac3317 100644
--- a/src/main/java/org.onosproject.xran/impl/XranConfig.java
+++ b/src/main/java/org.onosproject.xran/impl/XranConfig.java
@@ -17,9 +17,7 @@
package org.onosproject.xran.impl;
import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.commons.lang.exception.ExceptionUtils;
import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
import org.onosproject.net.config.Config;
import org.onosproject.xran.codecs.api.ECGI;
import org.onosproject.xran.codecs.api.EUTRANCellIdentifier;
@@ -32,18 +30,15 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import static org.onosproject.net.DeviceId.deviceId;
-
public class XranConfig extends Config<ApplicationId> {
private static final String CELLS = "active_cells";
private static final String PLMN_ID = "plmn_id";
+
private static final String ECI_ID = "eci";
private static final String IP_ADDR = "ip_addr";
@@ -52,7 +47,7 @@
private static final String XRANC_CELLCONFIG_INTERVAL = "xranc_cellconfigrequest_interval_seconds";
- private static final String RX_SIGNAL_MEAS_REPORT_INTERVAL = "rx_signal_meas_report_interval_seconds";
+ private static final String RX_SIGNAL_MEAS_REPORT_INTERVAL = "rx_signal_meas_report_interval_ms";
private static final String L2_MEAS_REPORT_INTERVAL = "l2_meas_report_interval_ms";
@@ -60,6 +55,12 @@
private static final String BEARER_SUCCESS = "bearer_success";
+ private static final String NO_MEAS_LINK_REMOVAL = "no_meas_link_removal_ms";
+
+ private static final String IDLE_UE_REMOVAL = "idle_ue_removal_ms";
+
+ private static final String NORTHBOUND_TIMEOUT = "nb_response_timeout_ms";
+
private final Logger log = LoggerFactory.getLogger(getClass());
public Map<String, ECGI> activeCellSet() {
@@ -110,6 +111,17 @@
return object.get(L2_MEAS_REPORT_INTERVAL).asInt();
}
+ public int getNoMeasLinkRemoval() {
+ return object.get(NO_MEAS_LINK_REMOVAL).asInt();
+ }
+
+ public int getIdleUeRemoval() {
+ return object.get(IDLE_UE_REMOVAL).asInt();
+ }
+
+ public int getNorthBoundTimeout() {
+ return object.get(NORTHBOUND_TIMEOUT).asInt();
+ }
private ECGI hexToECGI(String plmn_id, String eci) {
byte[] bytes = HexConverter.fromShortHexString(plmn_id);
diff --git a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
index f89fe09..af2a24a 100644
--- a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
@@ -47,7 +47,7 @@
private DeviceProviderService providerService;
public CellDeviceProvider() {
- super(new ProviderId("xran", "org.onosproject.provider.xran"));
+ super(new ProviderId("xran", "org.onosproject.providers.cell"));
}
@Activate
@@ -101,7 +101,7 @@
Device.Type type = Device.Type.OTHER;
SparseAnnotations annotations = DefaultAnnotations.builder()
- .set(AnnotationKeys.NAME, "eNodeB #" + cell.getEcgi().getEUTRANcellIdentifier())
+ .set(AnnotationKeys.NAME, "eNodeB " + cell.getEcgi().getEUTRANcellIdentifier())
.set(AnnotationKeys.PROTOCOL, "SCTP")
.set(AnnotationKeys.CHANNEL_ID, "xxx")
.set(AnnotationKeys.MANAGEMENT_ADDRESS, "127.0.0.1")
diff --git a/src/main/java/org.onosproject.xran/providers/UeProvider.java b/src/main/java/org.onosproject.xran/providers/UeProvider.java
index c7a76b9..2205c60 100644
--- a/src/main/java/org.onosproject.xran/providers/UeProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/UeProvider.java
@@ -53,7 +53,7 @@
private HostProviderService providerService;
public UeProvider() {
- super(new ProviderId("xran", "org.onosproject.providers.cell"));
+ super(new ProviderId("xran", "org.onosproject.providers.ue"));
}
@Activate
@@ -87,7 +87,7 @@
}
if (ue == null) {
- log.error("UE {} is not found", ue);
+ log.error("UE is not found");
return;
}
@@ -97,7 +97,7 @@
ecgiSet.forEach(ecgi -> hostLocations.add(new HostLocation(deviceId(uri(ecgi)), PortNumber.portNumber(0), 0)));
SparseAnnotations annotations = DefaultAnnotations.builder()
- .set(AnnotationKeys.NAME, "UE #" + ue.getMmeS1apId())
+ .set(AnnotationKeys.NAME, "UE " + ue.getMmeS1apId())
.build();
DefaultHostDescription desc = new DefaultHostDescription(
diff --git a/src/main/java/org.onosproject.xran/rest/CellWebResource.java b/src/main/java/org.onosproject.xran/rest/CellWebResource.java
index c738b40..566e8b9 100644
--- a/src/main/java/org.onosproject.xran/rest/CellWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/CellWebResource.java
@@ -22,6 +22,7 @@
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.slf4j.Logger;
@@ -119,7 +120,7 @@
queue[0] = get(XranController.class).sendModifiedRRMConf(cell.getRrmConfig(),
cell.getVersion() <= 3);
- String poll = queue[0].poll(5, TimeUnit.SECONDS);
+ String poll = queue[0].poll(get(XranControllerImpl.class).northbound_timeout, TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
diff --git a/src/main/java/org.onosproject.xran/rest/LinkWebResource.java b/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
index 097cab9..0213beb 100644
--- a/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
+++ b/src/main/java/org.onosproject.xran/rest/LinkWebResource.java
@@ -24,6 +24,7 @@
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.entities.RnibLink;
import org.onosproject.xran.entities.RnibUe;
@@ -290,7 +291,7 @@
.findFirst();
if (primary.isPresent()) {
queue[0] = get(XranController.class).sendHORequest(link, primary.get());
- String poll = queue[0].poll(5, TimeUnit.SECONDS);
+ String poll = queue[0].poll(get(XranControllerImpl.class).northbound_timeout, TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
@@ -364,7 +365,7 @@
case SERVING_SECONDARY_DC:
case NON_SERVING:
queue[0] = get(XranController.class).sendScellAdd(link);
- String poll = queue[0].poll(5, TimeUnit.SECONDS);
+ String poll = queue[0].poll(get(XranControllerImpl.class).northbound_timeout, TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
mapper(),
@@ -433,7 +434,7 @@
"xICIC was sent successfully"
);
} else {
- String poll = queue[0].poll(5, TimeUnit.SECONDS);
+ String poll = queue[0].poll(get(XranControllerImpl.class).northbound_timeout, TimeUnit.MILLISECONDS);
if (poll != null) {
return ResponseHelper.getResponse(
diff --git a/src/main/java/org.onosproject.xran/wrapper/LinkMap.java b/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
index 033f132..5e62271 100644
--- a/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/LinkMap.java
@@ -16,8 +16,6 @@
package org.onosproject.xran.wrapper;
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
import org.onosproject.xran.XranStore;
import org.onosproject.xran.codecs.api.CRNTI;
import org.onosproject.xran.codecs.api.ECGI;
@@ -25,7 +23,6 @@
import org.onosproject.xran.entities.RnibCell;
import org.onosproject.xran.entities.RnibLink;
import org.onosproject.xran.entities.RnibUe;
-import org.onosproject.xran.identifiers.LinkId;
import org.slf4j.Logger;
import java.util.List;
@@ -35,26 +32,29 @@
public class LinkMap {
private static final Logger log = getLogger(LinkMap.class);
- private final XranStore xranStore;
- private BiMap<CRNTI, MMEUES1APID> crntiMme = HashBiMap.create();
- public LinkMap(XranStore xranStore) {
+ private final XranStore xranStore;
+
+ private UeMap ueMap;
+
+ public LinkMap(XranStore xranStore, UeMap ueMap) {
this.xranStore = xranStore;
+ this.ueMap = ueMap;
}
public void putPrimaryLink(RnibCell cell, RnibUe ue) {
RnibLink link = new RnibLink(cell, ue);
link.setType(RnibLink.Type.SERVING_PRIMARY);
xranStore.storeLink(link);
- crntiMme.put(ue.getRanId(), ue.getMmeS1apId());
+
+ ueMap.putCrnti(cell, ue);
}
public RnibLink putNonServingLink(RnibCell cell, CRNTI crnti) {
RnibLink link = null;
- MMEUES1APID mmeues1APID = crntiMme.get(crnti);
+ RnibUe ue = ueMap.get(cell.getEcgi(), crnti);
- if (mmeues1APID != null) {
- RnibUe ue = xranStore.getUe(mmeues1APID);
+ if (ue != null) {
link = new RnibLink(cell, ue);
xranStore.storeLink(link);
} else {
@@ -71,41 +71,16 @@
}
public RnibLink get(ECGI src, CRNTI dst) {
- MMEUES1APID mmeues1APID = crntiMme.get(dst);
+ RnibUe ue = ueMap.get(src, dst);
- if (mmeues1APID != null) {
- return xranStore.getLink(src, mmeues1APID);
+ if (ue != null) {
+ return xranStore.getLink(src, ue.getMmeS1apId());
}
return null;
}
public CRNTI getCrnti(MMEUES1APID mme) {
- return crntiMme.inverse().get(mme);
- }
-
- public boolean remove(ECGI src, MMEUES1APID dst) {
- RnibLink link = xranStore.getLink(src, dst);
-
- if (link != null) {
- LinkId linkId = link.getLinkId();
- if (linkId != null) {
- return xranStore.removeLink(linkId);
- }
- }
- return false;
- }
-
- public boolean remove(ECGI src, CRNTI dst) {
- MMEUES1APID mmeues1APID = crntiMme.get(dst);
-
- RnibLink link = xranStore.getLink(src, mmeues1APID);
- if (link != null) {
- LinkId linkId = link.getLinkId();
- if (linkId != null) {
- return xranStore.removeLink(linkId);
- }
- }
- return false;
+ return ueMap.getCrntUe().inverse().get(mme).getValue();
}
public RnibCell getPrimaryCell(RnibUe ue) {
diff --git a/src/main/java/org.onosproject.xran/wrapper/UeMap.java b/src/main/java/org.onosproject.xran/wrapper/UeMap.java
index a42ecbd..1938a79 100644
--- a/src/main/java/org.onosproject.xran/wrapper/UeMap.java
+++ b/src/main/java/org.onosproject.xran/wrapper/UeMap.java
@@ -16,21 +16,25 @@
package org.onosproject.xran.wrapper;
+import com.google.common.base.Objects;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import io.netty.channel.ChannelHandlerContext;
+import javafx.util.Pair;
import org.onosproject.net.HostId;
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.ENBUES1APID;
import org.onosproject.xran.codecs.api.MMEUES1APID;
+import org.onosproject.xran.entities.RnibCell;
import org.onosproject.xran.entities.RnibUe;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class UeMap {
- private BiMap<CRNTI, MMEUES1APID> crntUe = HashBiMap.create();
+ private BiMap<EcgiCrntiPair, MMEUES1APID> crntUe = HashBiMap.create();
private XranStore xranStore;
@@ -38,21 +42,29 @@
this.xranStore = xranStore;
}
- public void put(RnibUe ue) {
+ public BiMap<EcgiCrntiPair, MMEUES1APID> getCrntUe() {
+ return crntUe;
+ }
+
+ public void putCrnti(RnibCell cell, RnibUe ue) {
+ CRNTI ranId = ue.getRanId();
+ ECGI ecgi = cell.getEcgi();
+ if (ranId != null && ecgi != null) {
+ crntUe.put(EcgiCrntiPair.valueOf(cell.getEcgi(),ue.getRanId()), ue.getMmeS1apId());
+ }
+ }
+
+ public void put(RnibCell cell, RnibUe ue) {
MMEUES1APID mmeS1apId = ue.getMmeS1apId();
if (mmeS1apId != null) {
xranStore.storeUe(ue);
- }
-
- CRNTI ranId = ue.getRanId();
- if (ranId != null) {
- crntUe.put(ranId, ue.getMmeS1apId());
+ putCrnti(cell, ue);
}
}
- public RnibUe get(CRNTI id) {
- MMEUES1APID mme = crntUe.get(id);
+ public RnibUe get(ECGI ecgi, CRNTI crnti) {
+ MMEUES1APID mme = crntUe.get(EcgiCrntiPair.valueOf(ecgi, crnti));
if (mme != null) {
return xranStore.getUe(mme);
}
@@ -70,4 +82,35 @@
crntUe.inverse().remove(id);
return xranStore.removeUe(id);
}
+
+ public static class EcgiCrntiPair extends Pair<ECGI, CRNTI> {
+
+ /**
+ * Creates a new pair
+ *
+ * @param key The key for this pair
+ * @param value The value to use for this pair
+ */
+ public EcgiCrntiPair(ECGI key, CRNTI value) {
+ super(key, value);
+ }
+
+ public static EcgiCrntiPair valueOf(ECGI key, CRNTI value) {
+ return new EcgiCrntiPair(key, value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(getKey(), getValue());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof EcgiCrntiPair) {
+ return ((EcgiCrntiPair) o).getKey().equals(getKey()) &&
+ ((EcgiCrntiPair) o).getValue().equals(getValue());
+ }
+ return super.equals(o);
+ }
+ }
}
diff --git a/xran-cfg.json b/xran-cfg.json
index c2500d2..b1787a7 100644
--- a/xran-cfg.json
+++ b/xran-cfg.json
@@ -4,32 +4,30 @@
"xran": {
"active_cells": [
{
- "plmn_id": "220841",
- "eci": "FFFFFFA0",
- "ip_addr": "10.0.0.2"
+ "plmn_id": "000001",
+ "eci": "00000010",
+ "ip_addr": "1.1.1.1"
},
{
- "plmn_id": "220842",
- "eci": "FFFFFFB0",
- "ip_addr": "10.0.0.3"
+ "plmn_id": "000002",
+ "eci": "00000020",
+ "ip_addr": "1.1.1.2"
},
{
- "plmn_id": "220843",
- "eci": "FFFFFFC0",
- "ip_addr": "192.168.56.101"
- },
- {
- "plmn_id": "220844",
- "eci": "FFFFFFD0",
- "ip_addr": "127.0.0.1"
+ "plmn_id": "000003",
+ "eci": "00000030",
+ "ip_addr": "1.1.1.3"
}
],
"l2_meas_report_interval_ms": 30000,
- "rx_signal_meas_report_interval_seconds": 7,
+ "rx_signal_meas_report_interval_ms": 7000,
"xranc_cellconfigrequest_interval_seconds": 10,
"xranc_port": 7891,
"admission_success": true,
- "bearer_success": true
+ "bearer_success": true,
+ "no_meas_link_removal_ms": 10000,
+ "idle_ue_removal_ms": 10000,
+ "nb_response_timeout_ms": 10000
}
}
}