added javadocs and comments
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.