added javadocs and comments
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();